/* S4I Studio — overrides + composants compacts (Linear/Notion-like) */

:root {
  --navy: #061637;
  --navy-deep: #020617;
  --mint: #40c9a2;
  --mint-2: #5fdfb8;
  --ink: #0b1530;
  --muted: #6b7390;
  --line: rgba(11,21,48,.08);
  --line-strong: rgba(11,21,48,.14);
  --danger: #ef4444;
  --warn: #f59e0b;
  --info: #3b82f6;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { font-feature-settings: "cv11", "ss01", "ss03"; }

/* === Layout === */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100vh;
}

/* === Sidebar === */
.sidebar {
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 12px;
}
.sidebar-brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--mint);
  color: var(--navy);
  font-weight: 700;
  font-size: 12px;
  display: grid;
  place-items: center;
  letter-spacing: -0.04em;
}
.sidebar-brand-name {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.sidebar-section {
  margin-top: 16px;
}
.sidebar-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,.5);
  cursor: pointer;
  user-select: none;
}
.sidebar-section-header:hover { color: rgba(255,255,255,.8); }
.sidebar-section-header .chev {
  transition: transform .12s;
}
.sidebar-section.is-collapsed .chev {
  transform: rotate(-90deg);
}
.sidebar-section.is-collapsed .sidebar-section-items {
  display: none;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  color: rgba(255,255,255,.78);
  font-size: 13px;
  text-decoration: none;
  margin-top: 1px;
  transition: background .12s, color .12s;
}
.sidebar-link:hover {
  background: rgba(255,255,255,.05);
  color: #fff;
}
.sidebar-link.is-active {
  background: rgba(64,201,162,.12);
  color: var(--mint);
}
.sidebar-link svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.85;
}
.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s;
  position: relative;
}
.sidebar-user:hover { background: rgba(255,255,255,.05); }
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--mint);
  color: var(--navy);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 12px;
  flex-shrink: 0;
}
.sidebar-user-info {
  font-size: 13px;
  line-height: 1.2;
  flex: 1;
  min-width: 0;
}
.sidebar-user-info .name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-info .role {
  color: rgba(255,255,255,.5);
  font-size: 11px;
  text-transform: capitalize;
}
.sidebar-user-menu {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 8px;
  right: 8px;
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18), 0 0 0 1px var(--line);
  padding: 4px;
  z-index: 100;
}
.sidebar-user-menu button {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 13px;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--ink);
}
.sidebar-user-menu button:hover { background: #f4f5f7; }

/* === Topbar === */
.topbar {
  height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--ink); }
.breadcrumbs .current { color: var(--ink); font-weight: 500; }
.breadcrumbs-sep { opacity: .4; }
.topbar-search {
  flex: 1;
  max-width: 360px;
  margin: 0 auto;
  position: relative;
}
.topbar-search input {
  width: 100%;
  height: 32px;
  background: #f2f4f8;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 10px 0 32px;
  font-size: 13px;
  color: var(--ink);
  font-family: inherit;
  transition: border-color .12s, background .12s;
}
.topbar-search input:focus {
  outline: 0;
  border-color: var(--mint);
  background: #fff;
}
.topbar-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}
.topbar-search-kbd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 10px;
  color: var(--muted);
  background: #fff;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  position: relative;
}
.icon-btn:hover { background: #f2f4f8; color: var(--ink); }
.icon-btn-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--danger);
}

/* === Main content area === */
.main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .12s, border-color .12s, transform .05s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--mint);
  color: var(--navy);
  font-weight: 600;
}
.btn-primary:hover { background: var(--mint-2); }
.btn-secondary {
  background: #fff;
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn-secondary:hover { background: #f8f9fb; }
.btn-ghost {
  background: transparent;
  color: var(--muted);
}
.btn-ghost:hover { background: #f2f4f8; color: var(--ink); }
.btn-danger {
  background: #fff;
  color: var(--danger);
  border-color: rgba(239,68,68,.3);
}
.btn-danger:hover { background: #fef2f2; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-sm { height: 26px; padding: 0 8px; font-size: 12px; }
.btn-lg { height: 38px; padding: 0 16px; font-size: 14px; }
.btn-block { width: 100%; }

/* === Inputs === */
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
}
.field-helper { font-size: 11px; color: var(--muted); }
.field-error { font-size: 11px; color: var(--danger); }
.input,
.textarea,
.select {
  height: 32px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  transition: border-color .12s, box-shadow .12s;
}
.textarea {
  height: auto;
  min-height: 80px;
  padding: 8px 10px;
  resize: vertical;
}
.input:focus, .textarea:focus, .select:focus {
  outline: 0;
  border-color: var(--mint);
  box-shadow: 0 0 0 3px rgba(64,201,162,.15);
}

/* === Card === */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-body { padding: 16px; }

/* === Stat card === */
.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
}
.stat-card-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 4px;
}
.stat-card-value {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.stat-card-trend {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

/* === Empty states === */
.empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--muted);
  font-size: 13px;
}
.empty-icon {
  width: 32px;
  height: 32px;
  margin: 0 auto 10px;
  opacity: .4;
}

/* === Toast === */
.toast {
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  min-width: 240px;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in .18s ease-out;
}
.toast-success { background: var(--mint); color: var(--navy); }
.toast-danger  { background: var(--danger); }
.toast-warn    { background: var(--warn); color: var(--navy); }
.toast-info    { background: var(--info); }
@keyframes toast-in {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* === Login screen === */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(64,201,162,.08), transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(59,130,246,.06), transparent 50%),
    #f2f4f8;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 4px 16px rgba(11,21,48,.04);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.login-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}
.login-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
}

/* Activity feed */
.activity-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.activity-row:last-child { border-bottom: 0; }
.activity-row .avatar { width: 24px; height: 24px; font-size: 10px; }
.activity-time {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.activity-summary { flex: 1; line-height: 1.4; }

/* Drafts list */
.draft-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.draft-item:last-child { border-bottom: 0; }
.draft-kind {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
  background: #f2f4f8;
  color: var(--muted);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Loader skeleton */
.skel {
  background: linear-gradient(90deg, #eef0f4 25%, #f6f7f9 50%, #eef0f4 75%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.4s infinite;
  border-radius: 4px;
}
@keyframes skel-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skel-line { height: 12px; margin-bottom: 6px; }
.skel-card { height: 80px; }

/* Mini chart */
.mini-chart {
  width: 100%;
  height: 140px;
}
.mini-chart .area { fill: rgba(64,201,162,.12); }
.mini-chart .line { fill: none; stroke: var(--mint); stroke-width: 1.5; }
.mini-chart .axis { fill: var(--muted); font-size: 10px; font-family: "JetBrains Mono", monospace; }
