:root {
  --brand: #163250;
  --brand-strong: #0d2238;
  --accent: #c5853f;
  --text: #172638;
  --text-soft: #5f6f82;
  --border: rgba(255, 255, 255, 0.1);
  --sidebar-width: 220px;
  --sidebar-collapsed-width: 56px;
  --shadow-lg: 0 18px 46px rgba(20, 43, 69, 0.18);
  --radius-sm: 10px;
  --transition: 240ms ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; overflow: hidden; }

body {
  font-family: "Aptos", "Bahnschrift", "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(160deg, #d8e4ef 0%, #f4f0e7 100%);
}

/* ── Shell ───────────────────────────────────────────────── */

.shell {
  display: flex;
  height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--brand);
  display: flex;
  flex-direction: column;
  transition: width var(--transition), min-width var(--transition);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  z-index: 10;
}

/* Brand */

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-logo {
  width: 32px;
  height: 32px;
  min-width: 32px;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
  overflow: hidden;
}

.sidebar-eyebrow {
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 4px;
  white-space: nowrap;
}

.sidebar-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

/* Nav */

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 8px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
  width: 100%;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
}

.nav-item.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.nav-icon {
  width: 18px;
  height: 18px;
  min-width: 18px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity var(--transition), width var(--transition);
}

/* Collapse button */

.sidebar-collapse {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 8px 12px;
  padding: 8px;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}

.sidebar-collapse:hover {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.8);
}

.sidebar-collapse svg {
  width: 16px;
  height: 16px;
  transition: transform var(--transition);
}

/* ── Collapsed state ─────────────────────────────────────── */

.shell.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-width);
  min-width: var(--sidebar-collapsed-width);
}

.shell.sidebar-collapsed .sidebar-brand-text,
.shell.sidebar-collapsed .nav-label,
.shell.sidebar-collapsed .sidebar-eyebrow {
  opacity: 0;
  pointer-events: none;
  width: 0;
}

.shell.sidebar-collapsed .sidebar-collapse svg {
  transform: rotate(180deg);
}

.shell.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 10px;
}

.shell.sidebar-collapsed .sidebar-header {
  justify-content: center;
  padding: 20px 0 18px;
}

/* ── Content ─────────────────────────────────────────────── */

.shell-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.tool-panel {
  display: none;
  position: absolute;
  inset: 0;
}

.tool-panel.active {
  display: block;
}

.tool-frame {
  width: 100%;
  height: 100%;
  border: none;
}
