/*
 * Outstash portal design layer (0.0.48).
 * Loads after app.css. It sets one type scale, one spacing scale, calm neutral
 * surfaces, and consistent controls, and matches the sales site (navy, light blue).
 * System fonts only: no third-party font request. Remove the <link> to design.css to fall back to app.css alone.
 */

:root,
:root[data-theme="light"] {
  --off: #f6f8fb;
  --white: #ffffff;
  --surface-2: #f1f4f8;
  --navy: #0b1f3a;
  --navy-mid: #1c3354;
  --ink: #0f1d33;
  --text-navy: #0f1d33;
  --muted: #5b6b80;
  --faint: #8a97a8;
  --line: #e3e8ef;
  --line-strong: #cfd8e3;
  --blue: #2f8cff;
  --blue-soft: #a8d4ff;
  --blue-wash: #eef5ff;
  --accent: #0b1f3a;
  --accent-ink: #ffffff;
  --hover: rgba(15, 29, 51, 0.05);
  --shadow-sm: 0 1px 2px rgba(15, 29, 51, 0.06);
  --shadow-lg: 0 12px 32px rgba(15, 29, 51, 0.12), 0 2px 6px rgba(15, 29, 51, 0.06);
  --radius: 10px;
  --radius-sm: 8px;
}

:root[data-theme="dark"] {
  --off: #0a111d;
  --white: #111a29;
  --surface-2: #0d1522;
  --navy: #e8eef7;
  --navy-mid: #c9d5e6;
  --ink: #e8eef7;
  --text-navy: #e8eef7;
  --muted: #94a3b8;
  --faint: #64748b;
  --line: #1e293b;
  --line-strong: #2b3a51;
  --blue: #5aa9ff;
  --blue-soft: #8cc4ff;
  --blue-wash: #12233a;
  --accent: #5aa9ff;
  --accent-ink: #061322;
  --hover: rgba(232, 238, 247, 0.06);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Type */
body {
  background: var(--off);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3 {
  letter-spacing: -0.015em;
}

.quiet,
.hint,
.company,
.tagline,
.welcome-foot,
.menu p {
  color: var(--muted);
  font-weight: 400;
}

/* Header */
:root[data-theme] header.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  min-height: 56px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--off) 85%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}

:root[data-theme] .brand {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.brand .brand-accent {
  color: var(--blue);
}

:root[data-theme] .account {
  display: flex;
  align-items: center;
  gap: 8px;
}

:root[data-theme] .usage-pill {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
}

/* Buttons */
:root[data-theme] .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  box-shadow: none;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

:root[data-theme] .btn:hover {
  background: var(--hover);
  border-color: var(--line-strong);
}

:root[data-theme] .btn.ghost {
  border-color: transparent;
}

:root[data-theme] .btn.ghost:hover {
  background: var(--hover);
}

:root[data-theme] .btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

:root[data-theme] .btn.primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, var(--ink));
}

:root[data-theme] .icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

:root[data-theme] .icon-btn:hover {
  background: var(--hover);
  color: var(--ink);
}

:root[data-theme] .btn:focus-visible,
:root[data-theme] .icon-btn:focus-visible,
:root[data-theme] .menu-item:focus-visible,
:root[data-theme] .projects button:focus-visible,
:root[data-theme] input:focus-visible,
:root[data-theme] select:focus-visible,
:root[data-theme] textarea:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* Fields */
:root[data-theme] input[type="text"],
:root[data-theme] input[type="search"],
:root[data-theme] input:not([type]),
:root[data-theme] select,
:root[data-theme] textarea {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

/* Layout */
:root[data-theme] .layout {
  min-height: calc(100vh - 56px);
}

:root[data-theme] .sidebar {
  padding: 18px 12px;
  border-right: 1px solid var(--line);
  background: var(--surface-2);
}

:root[data-theme] .sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 4px 10px 8px;
}

:root[data-theme] .sidebar-head h2 {
  margin: 0;
  color: var(--faint);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

:root[data-theme] #new-project {
  min-height: 28px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 13px;
}

:root[data-theme] #new-project:hover {
  color: var(--ink);
}

:root[data-theme] .projects {
  gap: 2px;
}

:root[data-theme] .projects button {
  min-height: 34px;
  padding: 7px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
}

:root[data-theme] .projects button:hover {
  background: var(--hover);
  color: var(--ink);
}

:root[data-theme] .projects button[aria-current="true"] {
  background: var(--blue-wash);
  color: var(--ink);
  box-shadow: inset 2px 0 0 var(--blue);
}

:root[data-theme] .main {
  padding: 40px 48px 64px;
}

/* Empty state */
:root[data-theme] .empty-home {
  max-width: 680px;
  padding: 8px 0 0;
  border: 0;
  background: transparent;
}

:root[data-theme] .empty-kicker {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

:root[data-theme] .empty-title {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

:root[data-theme] .empty-lead {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 400;
}

:root[data-theme] .empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 32px;
}

.empty-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.empty-steps li {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.empty-steps .step-num {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-bottom: 10px;
  border-radius: 999px;
  background: var(--blue-wash);
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.empty-steps strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.empty-steps p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}

/* Cards: stashes, panels, menus, dialogs */
:root[data-theme] .item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

:root[data-theme] .item:hover {
  border-color: var(--line-strong);
}

:root[data-theme] .menu {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-lg);
}

:root[data-theme] .menu-item {
  border-radius: 6px;
  color: var(--ink);
  font-weight: 500;
}

:root[data-theme] .menu-item:hover {
  background: var(--hover);
}

:root[data-theme] .welcome {
  background: rgba(6, 12, 22, 0.55);
  backdrop-filter: blur(4px);
}

:root[data-theme] .welcome-card,
:root[data-theme] .modal-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
  box-shadow: var(--shadow-lg);
}

:root[data-theme] .welcome-kicker {
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

:root[data-theme] .welcome-card h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

:root[data-theme] .welcome-lead,
:root[data-theme] .welcome-steps {
  color: var(--muted);
  font-weight: 400;
}

:root[data-theme] .welcome-steps strong {
  color: var(--ink);
  font-weight: 600;
}

:root[data-theme] .welcome-dismiss {
  color: var(--muted);
  font-weight: 500;
}

/* Tour: a small floating card, not a full-width banner */
:root[data-theme] .tour {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  width: min(380px, calc(100vw - 48px));
  margin: 0;
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--white);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}

:root[data-theme] .tour h2,
:root[data-theme] .tour #tour-title {
  margin: 2px 0 6px;
  font-size: 16px;
  font-weight: 600;
}

:root[data-theme] .tour p {
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}

:root[data-theme] .tour-kicker {
  color: var(--blue);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

:root[data-theme] .tour-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

/* Footer and report line */
:root[data-theme] .report,
:root[data-theme] footer {
  color: var(--faint);
  font-size: 13px;
  font-weight: 400;
}

/* Package output */
:root[data-theme] .package {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  font-size: 14px;
}

@media (max-width: 767px) {
  :root[data-theme] header.top {
    padding: 0 12px;
  }

  :root[data-theme] .account {
    gap: 4px;
  }

  :root[data-theme] .account .btn {
    padding: 0 10px;
    font-size: 13px;
  }

  :root[data-theme] .main {
    padding: 24px 18px calc(96px + env(safe-area-inset-bottom));
  }

  .empty-steps {
    grid-template-columns: 1fr;
  }

  :root[data-theme] .empty-title {
    font-size: 26px;
  }

  :root[data-theme] .tour {
    right: 12px;
    bottom: calc(88px + env(safe-area-inset-bottom));
    left: 12px;
    width: auto;
  }
}

/* Keep app.css visibility rules: hidden elements, the phone-only add button, and the drawer toggle. */
:root[data-theme] [hidden] {
  display: none !important;
}

@media (min-width: 768px) {
  :root[data-theme] .mobile-add,
  :root[data-theme] #projects-toggle {
    display: none;
  }
}

:root[data-theme] .mobile-add {
  width: 52px;
  height: 52px;
  padding: 0;
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
}

:root[data-theme] .welcome-actions {
  margin: 20px 0 12px;
}

/* Project page: Paid tools as compact cards in a two-column grid */
:root[data-theme] .project-ask {
  gap: 8px;
  margin-top: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

:root[data-theme] .project-ask h3 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

:root[data-theme] .project-ask .hint {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}

:root[data-theme] .project-ask textarea {
  min-height: 64px;
  resize: vertical;
}

:root[data-theme] .project-ask .btn,
:root[data-theme] .project-ask button {
  min-height: 32px;
  font-size: 13.5px;
}

:root[data-theme] .lock {
  opacity: 0.7;
}

@media (min-width: 1100px) {
  :root[data-theme] #main {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 12px;
    align-items: start;
  }

  :root[data-theme] #main > :not(.project-ask) {
    grid-column: 1 / -1;
  }

  /* Wide screens: the content column is centered in the space beside the sidebar. */
  :root[data-theme] .main {
    flex: 1 1 auto;
    max-width: none;
  }

  :root[data-theme] .main > :not(.mobile-add) {
    max-width: 1040px;
    margin-right: auto;
    margin-left: auto;
  }
}

/* Tags */
:root[data-theme] .tag,
:root[data-theme] .tag-add {
  min-height: 26px;
  padding: 2px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
}

:root[data-theme] .tag-add:hover {
  background: var(--hover);
  color: var(--ink);
}

/* Destructive actions */
:root[data-theme] .menu-item.danger {
  color: #e5484d;
}

:root[data-theme] .btn.danger {
  border-color: #e5484d;
  background: #e5484d;
  color: #ffffff;
  font-weight: 600;
}

:root[data-theme] .btn.danger:hover {
  background: #cf3f44;
}

:root[data-theme] .btn.danger:disabled {
  opacity: 0.6;
  cursor: progress;
}

/* AI-polished package: label shown above the text, not included when copied. Only when AI wrote part of it. */
:root[data-theme] #package[data-ai="true"]:not([hidden])::before {
  content: "Generated with AI. Check it, and verify every citation, before you use it.";
  display: block;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  white-space: normal;
}

/* Shared Outstash type and spacing tokens: match the sales home and side panel. */
:root,
:root[data-theme="light"] {
  --blue: #4da3ff;
  --blue-soft: #a8d4ff;
  --blue-wash: #e8f3ff;
  --off: #f7fafc;
  --muted: #5a6b7d;
  --line: #d7e3f0;
  --radius: 14px;
  --radius-sm: 8px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
}
:root[data-theme] body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
