/* ============================================================
   Resum3 — design tokens + base styles
   ============================================================ */

:root {
  /* accent is injected from Tweaks; default emerald */
  --accent: #0f9d6e;

  --accent-strong: color-mix(in oklab, var(--accent), #000 16%);
  --accent-press:  color-mix(in oklab, var(--accent), #000 28%);
  --accent-soft:   color-mix(in oklab, var(--accent), #fff 88%);
  --accent-softer: color-mix(in oklab, var(--accent), #fff 94%);
  --accent-ring:   color-mix(in oklab, var(--accent), #fff 34%);
  --accent-ink:    color-mix(in oklab, var(--accent), #000 38%);

  --radius: 18px;
  --radius-sm: calc(var(--radius) * 0.55);
  --radius-lg: calc(var(--radius) * 1.35);
  --pad: 22px;

  /* light theme surfaces */
  --canvas: #f4f5f7;
  --canvas-2: #eceef1;
  --surface: #ffffff;
  --surface-2: #fbfbfc;
  --surface-3: #f6f7f9;
  --line: rgba(15, 23, 42, 0.08);
  --line-2: rgba(15, 23, 42, 0.13);
  --ink: #111722;
  --ink-2: #44505f;
  --ink-3: #6b7785;
  --ink-4: #9aa4b1;

  --amber: #c0791b;
  --amber-soft: #fdf4e3;
  --amber-line: #f0d49a;
  --amber-ink: #87560f;

  --rose: #d24b52;
  --rose-soft: #fdecec;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 14px -6px rgba(15, 23, 42, 0.14), 0 2px 6px -3px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 22px 48px -20px rgba(15, 23, 42, 0.28), 0 8px 20px -12px rgba(15, 23, 42, 0.14);
  --shadow-pop: 0 30px 70px -24px rgba(8, 15, 30, 0.40), 0 10px 24px -14px rgba(8, 15, 30, 0.20);

  --font-ui: 'Hanken Grotesk', system-ui, sans-serif;
  --font-doc: 'Source Serif 4', Georgia, serif;
}

[data-font='humanist'] { --font-ui: 'Figtree', system-ui, sans-serif; }
[data-font='editorial'] { --font-ui: 'Schibsted Grotesk', system-ui, sans-serif; }

[data-density='compact'] { --pad: 16px; }
[data-density='comfy']   { --pad: 28px; }

[data-theme='dark'] {
  --accent-soft:   color-mix(in oklab, var(--accent), #0c1014 78%);
  --accent-softer: color-mix(in oklab, var(--accent), #0c1014 86%);
  --accent-ring:   color-mix(in oklab, var(--accent), #0c1014 30%);
  --accent-ink:    color-mix(in oklab, var(--accent), #fff 14%);

  --canvas: #0c0e12;
  --canvas-2: #07090c;
  --surface: #15181e;
  --surface-2: #181c23;
  --surface-3: #1d222a;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --ink: #f2f4f7;
  --ink-2: #b6bfca;
  --ink-3: #8b95a1;
  --ink-4: #69737f;

  --amber: #e3a34a;
  --amber-soft: #2a2113;
  --amber-line: #5c4621;
  --amber-ink: #f0c685;

  --rose: #f0787e;
  --rose-soft: #2c1719;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 18px -8px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 24px 50px -22px rgba(0, 0, 0, 0.7);
  --shadow-pop: 0 36px 80px -28px rgba(0, 0, 0, 0.8);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

#root { min-height: 100vh; }

button { font-family: inherit; cursor: pointer; }
textarea, input { font-family: inherit; }
::selection { background: var(--accent-ring); color: var(--accent-ink); }

/* scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--ink-4); background-clip: padding-box; }

/* ---------- app shell ---------- */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 600px at 88% -8%, var(--accent-softer), transparent 60%),
    var(--canvas);
  transition: background .3s ease, color .3s ease;
}

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* ---------- top nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in oklab, var(--canvas), transparent 18%);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { height: 64px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -0.02em; color: var(--ink); user-select: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(150deg, var(--accent), var(--accent-strong));
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 4px 12px -3px color-mix(in oklab, var(--accent), transparent 50%);
  flex: none;
}
.brand b { color: var(--accent-ink); }

.nav-links { display: flex; align-items: center; gap: 4px; margin-left: 8px; }
.nav-link {
  border: none; background: none; color: var(--ink-3);
  font-size: 14.5px; font-weight: 600; padding: 8px 13px; border-radius: 10px;
  transition: all .15s ease;
}
.nav-link:hover { color: var(--ink); background: var(--surface-3); }
.nav-link.active { color: var(--accent-ink); background: var(--accent-soft); }

.nav-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.credits {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line);
  padding: 7px 12px 7px 11px; border-radius: 99px; font-size: 13px; font-weight: 600;
  color: var(--ink-2); box-shadow: var(--shadow-sm); white-space: nowrap;
}
.credits b { color: var(--ink); }
.credits .dot { width: 7px; height: 7px; border-radius: 99px; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.credits.low .dot { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }

.avatar {
  width: 36px; height: 36px; border-radius: 99px; border: 1px solid var(--line);
  background: var(--surface); overflow: hidden; padding: 0; flex: none;
  box-shadow: var(--shadow-sm); display: grid; place-items: center;
  font-weight: 700; font-size: 13px; color: var(--accent-ink);
  background: var(--accent-soft);
}
.avatar:hover { box-shadow: var(--shadow-md); }

/* ---------- generic surfaces ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
}

.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-4); }
.muted { color: var(--ink-3); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  border: 1px solid transparent; border-radius: 12px;
  font-size: 14.5px; font-weight: 650; padding: 11px 18px; letter-spacing: -0.01em;
  transition: transform .08s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease, color .15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; }

.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 16px -6px color-mix(in oklab, var(--accent), transparent 40%); }
.btn-primary:hover { background: var(--accent-strong); box-shadow: 0 8px 20px -6px color-mix(in oklab, var(--accent), transparent 36%); }

.btn-ghost { background: var(--surface); color: var(--ink-2); border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { color: var(--ink); border-color: var(--ink-4); }

.btn-soft { background: var(--surface-3); color: var(--ink-2); }
.btn-soft:hover { background: var(--canvas-2); color: var(--ink); }

.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; gap: 7px; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-lg { padding: 14px 24px; font-size: 15.5px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* ---------- page transitions ---------- */
.page { animation: pageIn .42s cubic-bezier(.22,.61,.36,1); }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- public footer ---------- */
.public-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  background: color-mix(in oklab, var(--canvas), var(--surface) 45%);
}
.footer-inner {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 18px;
  padding-bottom: 18px;
}
.footer-inner b { display: block; font-size: 14px; color: var(--ink); }
.footer-inner span { display: block; margin-top: 3px; font-size: 13px; color: var(--ink-3); }
.footer-links { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.footer-links a { color: var(--ink-3); font-size: 13px; font-weight: 700; text-decoration: none; }
.footer-links a:hover { color: var(--accent-ink); }

/* ---------- AI assistant ---------- */
.chat {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 75;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  pointer-events: none;
}
.chat-panel {
  width: min(390px, calc(100vw - 28px));
  height: min(590px, calc(100dvh - 112px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: auto;
  box-shadow: var(--shadow-pop);
  animation: chatIn .2s ease;
}
@keyframes chatIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.chat-head {
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.chat-title {
  display: flex;
  gap: 10px;
  min-width: 0;
}
.chat-title b {
  display: block;
  font-size: 14.5px;
  line-height: 1.15;
}
.chat-title span {
  display: block;
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.25;
}
.chat-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  flex: none;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(150deg, var(--accent), var(--accent-strong));
}
.chat-mark svg { width: 17px; height: 17px; }
.chat-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-3);
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex: none;
}
.chat-close svg { width: 16px; height: 16px; }
.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  background: var(--surface-2);
}
.chat-support {
  display: block;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--accent-ink);
  background: var(--accent-softer);
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
}
.chat-support:hover { text-decoration: underline; }
.chat-msg {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 13px;
  font-size: 13.5px;
  line-height: 1.42;
  overflow-wrap: anywhere;
}
.chat-msg.assistant {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-2);
}
.chat-msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
}
.chat-msg.typing {
  color: var(--ink-4);
  font-style: italic;
}
.chat-quick {
  padding: 10px 12px 0;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  background: var(--surface);
}
.chat-quick button {
  border: 1px solid var(--line);
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 650;
  border-radius: 999px;
  padding: 7px 10px;
  white-space: nowrap;
}
.chat-form {
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  background: var(--surface);
}
.chat-form input {
  min-width: 0;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--ink);
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 14px;
  outline: none;
}
.chat-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--surface);
}
.chat-fab {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  border: none;
  display: grid;
  place-items: center;
  pointer-events: auto;
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-pop);
}
.chat-fab svg { width: 23px; height: 23px; }

@media (max-width: 720px) {
  .wrap { padding: 0 max(14px, env(safe-area-inset-left)); }
  .nav-links { display: none; }
}

@media (max-width: 640px) {
  :root { --pad: 16px; --radius: 15px; }
  body { min-width: 0; }
  .app {
    background:
      radial-gradient(620px 360px at 100% -8%, var(--accent-softer), transparent 62%),
      var(--canvas);
  }
  .nav { top: 0; }
  .nav-inner {
    height: auto;
    min-height: 58px;
    padding-top: max(9px, env(safe-area-inset-top));
    padding-bottom: 9px;
    gap: 10px;
  }
  .brand { font-size: 16px; gap: 8px; min-width: 0; }
  .brand-mark { width: 28px; height: 28px; border-radius: 8px; }
  .nav-right { gap: 8px; min-width: 0; }
  .credits {
    max-width: 130px;
    padding: 7px 10px;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .avatar { width: 34px; height: 34px; font-size: 12px; }
  .btn {
    min-height: 44px;
    white-space: normal;
    text-align: center;
  }
  .btn-sm { min-height: 38px; }
  .toast {
    left: 14px;
    right: 14px;
    bottom: max(14px, env(safe-area-inset-bottom));
    transform: none;
    justify-content: center;
    text-align: center;
  }
  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }
  .chat {
    right: 14px;
    bottom: max(14px, env(safe-area-inset-bottom));
  }
  .chat.open {
    left: 14px;
    align-items: stretch;
  }
  .chat-panel {
    width: 100%;
    height: min(560px, calc(100dvh - 94px));
  }
  .chat-fab {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    align-self: flex-end;
  }
  @keyframes toastIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
}
