:root {
  --bg: #f4f6f5;
  --panel: #ffffff;
  --ink: #17211d;
  --muted: #5d6b65;
  --faint: #8a9690;
  --line: #e2e8e5;
  --brand: #0e6b5c;
  --brand-ink: #ffffff;
  --brand-soft: #e3f2ee;
  --brand-dark: #0a5247;
  --sun: #f2a83b;
  --sun-soft: #fff4e2;
  --warn: #b45309;
  --warn-soft: #fff7ea;
  --bad: #b42318;
  --bad-soft: #fdecea;
  --good: #15803d;
  --good-soft: #e9f7ee;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 20, .05), 0 4px 16px rgba(16, 24, 20, .04);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); }
button, input, textarea, select { font: inherit; color: inherit; }
h1 { font-size: 28px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -0.02em; }
h2 { font-size: 19px; margin: 0 0 4px; letter-spacing: -0.01em; }
h3 { font-size: 15px; margin: 0 0 6px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); font-size: 13px; }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* layout */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 22px 16px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.testmode:not(.hidden) + #root .side { height: calc(100vh - 32px); top: 0; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; padding: 0 8px 14px; letter-spacing: -0.01em; }
.logo .mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--sun), #e8762b); display: grid; place-items: center; color: #fff; font-size: 16px; }
.logo small { display: block; font-weight: 500; font-size: 11px; color: var(--faint); letter-spacing: .02em; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--bg); }
.nav a.on { background: var(--brand-soft); color: var(--brand-dark); }
.nav .ic { width: 18px; text-align: center; opacity: .8; }
.side .grow { flex: 1; }
.credit-box { background: var(--sun-soft); border: 1px solid #f6dcb0; border-radius: 12px; padding: 12px 14px; }
.credit-box b { font-size: 22px; }
.bar { height: 6px; background: #f1e2c7; border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--sun); border-radius: 99px; }
.who { border-top: 1px solid var(--line); padding: 12px 8px 0; margin-top: 10px; font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.main { padding: 32px 40px 60px; max-width: 1280px; width: 100%; }

/* cards & bits */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card + .card { margin-top: 16px; }
.grid2 > .card + .card, .grid3 > .card + .card, .grid4 > .card + .card { margin-top: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.tile { display: block; text-decoration: none; color: inherit; cursor: pointer; transition: border-color .15s, transform .15s; }
.tile:hover { border-color: var(--brand); transform: translateY(-1px); }
.tile .tic { width: 42px; height: 42px; border-radius: 11px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 20px; margin-bottom: 12px; }
.banner { background: var(--brand-soft); border-radius: 12px; padding: 12px 16px; color: var(--brand-dark); margin: 14px 0; }
.banner.warn { background: var(--warn-soft); color: var(--warn); border: 1px solid #f4d8ad; }
.banner.bad { background: var(--bad-soft); color: var(--bad); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 10px 18px; font-weight: 600; cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: #c4d0cb; background: #fafcfb; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-dark); }
.btn.big { padding: 14px 24px; font-size: 16px; }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--bg); }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .spin, .spin { width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: #f7f9f8; border-radius: 999px; padding: 8px 14px; cursor: pointer; font-weight: 500; font-size: 14px; }
.chip:hover { border-color: var(--brand); background: var(--brand-soft); }
.chip:disabled { opacity: .5; cursor: not-allowed; }
.idea-chip { text-align: left; display: flex; gap: 8px; align-items: flex-start; }
.idea-chip small { color: var(--faint); display: block; font-size: 12px; }
.pill { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; background: var(--bg); color: var(--muted); }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.brand { background: var(--brand-soft); color: var(--brand-dark); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }

label { font-weight: 600; font-size: 14px; display: block; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.field .hint { font-weight: 400; color: var(--faint); font-size: 13px; }
input[type=text], input[type=password], input[type=number], textarea, select {
  width: 100%; border: 1px solid #d3ddd8; border-radius: 11px; padding: 11px 13px; background: #fff; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14, 107, 92, .12); }
textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
.idea-box { min-height: 120px; font-size: 16px; border-width: 2px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }

/* stepper */
.steps { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; color: var(--faint); font-weight: 500; }
.steps .st { display: flex; align-items: center; gap: 8px; }
.steps .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #e9eeec; color: var(--muted); font-size: 13px; font-weight: 700; }
.steps .st.on { color: var(--ink); font-weight: 700; }
.steps .st.on .n { background: var(--brand); color: #fff; }
.steps .st.done .n { background: var(--brand-soft); color: var(--brand); }
.steps .sep { color: #c6d0cc; }

/* write: polish layout */
.polish { display: grid; grid-template-columns: 360px 1fr; gap: 18px; align-items: start; }
.editor { width: 100%; min-height: 520px; border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; font-size: 15.5px; line-height: 1.65; background: #fff; resize: vertical; }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.issue { border-left: 3px solid var(--warn); padding: 6px 0 6px 12px; margin: 10px 0; }
.issue.high { border-color: var(--bad); }
.issue.low { border-color: #c9d4cf; }
.issue q { display: block; font-style: italic; color: var(--muted); font-size: 13px; margin: 2px 0; quotes: "\201C" "\201D"; }
.check-ok { background: var(--good-soft); color: var(--good); border-radius: 12px; padding: 12px 14px; font-weight: 600; }
.check-box { background: var(--warn-soft); border: 1px solid #f4d8ad; border-radius: 12px; padding: 14px 16px; }
.allow { font-size: 12.5px; color: var(--faint); margin-top: 8px; }
.progress-list { list-style: none; padding: 0; margin: 0 0 18px; }
.progress-list li { padding: 5px 0; color: var(--faint); display: flex; gap: 10px; align-items: center; }
.progress-list li.done { color: var(--good); }
.progress-list li.now { color: var(--ink); font-weight: 600; }
.skeleton { background: linear-gradient(90deg, #eef2f0 25%, #f7f9f8 50%, #eef2f0 75%); background-size: 200% 100%; animation: sk 1.4s infinite; border-radius: 8px; height: 12px; margin: 10px 0; }
@keyframes sk { to { background-position: -200% 0; } }

/* linkedin-ish preview */
.li { border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 16px 18px; max-width: 620px; }
.li .hd { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.li .av { width: 46px; height: 46px; border-radius: 50%; background: linear-gradient(135deg, #0e6b5c, #2e8f7c); color: #fff; display: grid; place-items: center; font-weight: 700; }
.li .nm { font-weight: 700; }
.li .hl { font-size: 12px; color: var(--faint); }
.li .tx { white-space: pre-wrap; font-size: 14.5px; line-height: 1.55; }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid #eef2f0; vertical-align: top; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #fafcfb; }
.kpi .v { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.kpi .l { color: var(--muted); font-size: 13px; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #17211d; color: #fff; padding: 11px 18px; border-radius: 999px; font-weight: 500; z-index: 50; box-shadow: 0 8px 30px rgba(0,0,0,.2); max-width: 90vw; }
.toast.bad { background: var(--bad); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login { width: 100%; max-width: 400px; }
.testmode { background: #fde68a; color: #713f12; text-align: center; font-weight: 700; padding: 6px; font-size: 13px; }
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 20, .45); display: grid; place-items: center; z-index: 40; padding: 20px; }
.modal { background: #fff; border-radius: 16px; padding: 24px; width: 100%; max-width: 760px; max-height: 90vh; overflow: auto; }
.post-row { display: flex; justify-content: space-between; gap: 14px; padding: 14px 0; border-bottom: 1px solid #eef2f0; align-items: flex-start; }
.post-row:last-child { border-bottom: 0; }
.post-row .snip { color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; cursor: pointer; font-weight: 500; }
.tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; }
  .side .grow, .who { display: none; }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .main { padding: 20px 16px 40px; }
  .polish, .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
}
