:root {
  --ink: #0f1c19;
  --soft: #56635f;
  --forest: #052f28;
  --emerald: #0a8d74;
  --mint: #dff2eb;
  --gold: #e0b45f;
  --paper: #fffdf9;
  --cream: #f2f3ee;
  --line: #d9dfd7;
  --red: #b43c2a;
  --shadow: 0 24px 70px rgba(11, 35, 30, .1);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: Arial, Helvetica, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #ffb703; outline-offset: 3px; }

.dashboard-body { min-height: 100vh; }
.auth-shell { width: min(100% - 32px, 540px); min-height: 100vh; margin: auto; padding: 48px 0; display: grid; align-content: center; }
.auth-brand { width: fit-content; margin: 0 auto 24px; display: grid; text-align: center; }
.auth-brand span { color: var(--forest); font-size: 20px; font-weight: 950; letter-spacing: -.04em; }
.auth-brand small { margin-top: 4px; color: var(--emerald); font-size: 8px; font-weight: 900; letter-spacing: .18em; }
.auth-card { padding: clamp(28px, 6vw, 50px); border: 1px solid var(--line); border-radius: 28px; background: var(--paper); box-shadow: var(--shadow); }
.kicker { margin: 0; color: var(--emerald); font-size: 11px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.auth-card h1 { margin: 13px 0 16px; font-size: clamp(38px, 8vw, 58px); line-height: 1; letter-spacing: -.06em; }
.auth-intro { margin: 0 0 28px; color: var(--soft); font-size: 16px; line-height: 1.65; }
.auth-form, .create-user form, .account-panel form { display: grid; gap: 18px; }
label { display: grid; gap: 8px; color: var(--ink); font-size: 13px; font-weight: 800; }
input, textarea, select { width: 100%; padding: 14px 15px; border: 1px solid #cbd3ca; border-radius: 11px; background: #fff; color: var(--ink); outline: none; font-weight: 500; line-height: 1.45; }
input:focus, textarea:focus, select:focus { border-color: var(--emerald); box-shadow: 0 0 0 4px rgba(10, 141, 116, .12); }
textarea { resize: vertical; }
label small { color: #77827f; font-size: 11px; font-weight: 500; line-height: 1.45; }
.primary-button, .secondary-button { min-height: 48px; padding: 13px 20px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 999px; cursor: pointer; background: var(--gold); color: var(--forest); font-size: 13px; font-weight: 900; }
.primary-button:hover { background: #efc66f; }
.primary-button.full { width: 100%; }
.secondary-button { border: 1px solid var(--line); background: var(--paper); }
.auth-help, .auth-footer { color: #75807c; font-size: 12px; line-height: 1.5; text-align: center; }
.auth-help { margin: 22px 0 0; }
.auth-footer { margin-top: 24px; }
.auth-footer a:hover { color: var(--emerald); }

.alert { margin: 0 0 24px; padding: 15px 17px; border-radius: 13px; font-size: 13px; font-weight: 700; line-height: 1.5; }
.alert.success { border: 1px solid #b8dfd2; background: #e4f5ef; color: #08614e; }
.alert.error { border: 1px solid #f0c7bf; background: #fff0ed; color: #8d2d1f; }
.alert ul { margin: 10px 0 0; padding-left: 20px; }
.alert code { font-weight: 900; }

.dash-header { min-height: 78px; padding: 0 clamp(20px, 4vw, 64px); display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: clamp(24px, 4vw, 60px); position: sticky; top: 0; z-index: 30; border-bottom: 1px solid var(--line); background: rgba(255, 253, 249, .97); backdrop-filter: blur(18px); }
.dash-logo { display: grid; }
.dash-logo strong { font-size: 16px; font-weight: 950; letter-spacing: -.035em; }
.dash-logo small { margin-top: 3px; color: var(--emerald); font-size: 7px; font-weight: 900; letter-spacing: .18em; }
.dash-header nav { display: flex; align-items: center; gap: clamp(16px, 2.4vw, 34px); color: var(--soft); font-size: 13px; font-weight: 750; }
.dash-header nav a { padding: 28px 0 25px; position: relative; white-space: nowrap; }
.dash-header nav a::after { content: ""; height: 3px; position: absolute; right: 0; bottom: -1px; left: 0; transform: scaleX(0); background: var(--emerald); transition: transform 180ms ease; }
.dash-header nav a:hover, .dash-header nav a.active { color: var(--forest); }
.dash-header nav a.active::after { transform: scaleX(1); }
.dash-user { display: flex; align-items: center; gap: 14px; }
.dash-user > span { display: grid; font-size: 12px; font-weight: 850; text-align: right; }
.dash-user small { margin-top: 2px; color: var(--emerald); font-size: 9px; text-transform: uppercase; }
.dash-user button { padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--forest); cursor: pointer; font-size: 11px; font-weight: 800; }
.dash-menu-button { display: none; }

.dash-main { width: min(1500px, calc(100% - 48px)); margin: 0 auto; padding: clamp(48px, 7vw, 90px) 0 110px; }
.dash-title { margin-bottom: 38px; display: flex; align-items: end; justify-content: space-between; gap: 36px; }
.dash-title h1 { max-width: 1000px; margin: 13px 0 14px; font-size: clamp(44px, 6.5vw, 86px); line-height: .96; letter-spacing: -.066em; overflow-wrap: anywhere; }
.dash-title > div > p:last-child { max-width: 700px; margin: 0; color: var(--soft); font-size: 17px; line-height: 1.6; }
.stat-grid { margin-bottom: 28px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-grid article { min-height: 150px; padding: 24px; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid var(--line); border-radius: 22px; background: var(--paper); box-shadow: 0 14px 38px rgba(11,35,30,.05); }
.stat-grid span { color: var(--soft); font-size: 12px; font-weight: 750; }
.stat-grid strong { color: var(--forest); font-size: 50px; line-height: 1; letter-spacing: -.06em; }
.stat-grid .role-stat { font-size: 26px; }
.panel, .editor-card { border: 1px solid var(--line); border-radius: 28px; background: var(--paper); box-shadow: 0 18px 54px rgba(11,35,30,.06); }
.panel { padding: clamp(24px, 3.2vw, 46px); }
.panel-heading { margin-bottom: 28px; display: flex; align-items: end; justify-content: space-between; gap: 30px; }
.panel-heading h2, .editor-card h2, .create-user h2, .account-panel h2 { margin: 8px 0 0; font-size: clamp(30px, 4vw, 48px); line-height: 1; letter-spacing: -.055em; }
.panel-heading > span { max-width: 450px; color: var(--soft); font-size: 12px; line-height: 1.5; text-align: right; }

.post-table { display: grid; gap: 12px; }
.post-row { min-width: 0; padding: 15px; display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; align-items: center; gap: 20px; border: 1px solid #e0e4de; border-radius: 18px; background: #fafbf8; }
.post-image { width: 110px; height: 80px; overflow: hidden; border-radius: 12px; background: var(--forest); }
.post-image img { width: 100%; height: 100%; object-fit: cover; }
.post-copy { min-width: 0; }
.post-copy > div:first-child { display: flex; align-items: center; gap: 10px; }
.post-copy time { color: #78837f; font-size: 10px; }
.status { padding: 5px 8px; border-radius: 999px; background: #e8ebe7; color: #65706c; font-size: 8px; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; }
.status.published { background: #d9f1e9; color: #08705b; }
.post-copy h3 { margin: 9px 0 5px; overflow: hidden; font-size: 19px; line-height: 1.2; letter-spacing: -.025em; text-overflow: ellipsis; white-space: nowrap; }
.post-copy p { margin: 0; overflow: hidden; color: #76817d; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.post-actions { display: flex; align-items: center; gap: 14px; font-size: 11px; font-weight: 850; }
.post-actions a, .post-actions button { padding: 0; border: 0; background: transparent; color: var(--emerald); cursor: pointer; font-size: inherit; font-weight: inherit; }
.post-actions .danger-link, .danger-link { color: var(--red); }
.empty-state { padding: 80px 20px; text-align: center; }
.empty-state h3 { margin: 0 0 10px; font-size: 32px; }
.empty-state p { margin: 0 0 24px; color: var(--soft); }

.editor-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(330px, .65fr); align-items: start; gap: 24px; }
.editor-card { padding: clamp(24px, 3vw, 40px); }
.editor-card h2 { margin: 0 0 28px; font-size: 34px; }
.editor-card label + label { margin-top: 22px; }
.article-input { min-height: 500px; line-height: 1.65; }
.slug-input { display: flex; align-items: center; overflow: hidden; border: 1px solid #cbd3ca; border-radius: 11px; background: #eff2ed; }
.slug-input:focus-within { border-color: var(--emerald); box-shadow: 0 0 0 4px rgba(10,141,116,.12); }
.slug-input span { padding-left: 14px; color: #6e7975; font-size: 12px; font-weight: 600; }
.slug-input input { border: 0; border-radius: 0; box-shadow: none; }
.editor-side { display: grid; gap: 18px; }
.cover-preview { width: 100%; aspect-ratio: 16 / 10; margin: 15px 0; border-radius: 14px; object-fit: cover; }
.google-preview { margin-top: 20px; padding: 17px; border-radius: 14px; background: #f1f4ef; }
.google-preview span { display: block; color: #477065; font-size: 10px; }
.google-preview strong { margin: 7px 0; display: block; color: #1454a0; font-size: 18px; font-weight: 500; line-height: 1.25; }
.google-preview p { margin: 0; color: #4f5a56; font-size: 12px; line-height: 1.5; }

.two-panel { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(330px, .65fr); align-items: start; gap: 24px; }
.user-list { display: grid; gap: 12px; }
.user-list article { padding: 17px; display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 15px; border: 1px solid var(--line); border-radius: 16px; background: #fafbf8; }
.user-avatar { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--forest); color: #fff; font-weight: 900; }
.user-list article > div:nth-child(2) { min-width: 0; display: grid; gap: 3px; }
.user-list article span { overflow: hidden; color: var(--soft); font-size: 12px; text-overflow: ellipsis; }
.user-list article small { color: var(--emerald); font-size: 9px; font-weight: 850; text-transform: uppercase; }
.user-controls { display: flex; align-items: center; gap: 12px; }
.inline-reset { display: flex; align-items: center; gap: 7px; }
.inline-reset input { width: 170px; padding: 9px 10px; font-size: 11px; }
.inline-reset button, .user-controls .danger-link { padding: 9px 11px; border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer; font-size: 10px; font-weight: 850; }
.create-user { position: sticky; top: 100px; }
.create-user > p:nth-of-type(2), .account-panel > p { color: var(--soft); line-height: 1.6; }
.create-user form { margin-top: 28px; }
.account-panel { max-width: 700px; }
.account-panel form { margin-top: 30px; }

@media (max-width: 1080px) {
  .dash-header { grid-template-columns: auto auto 1fr; }
  .dash-menu-button { min-width: 44px; height: 40px; display: block; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--forest); cursor: pointer; font-size: 11px; font-weight: 850; }
  .dash-header nav { padding: 10px; position: absolute; top: calc(100% + 8px); right: 20px; left: 20px; display: none; align-items: stretch; flex-direction: column; gap: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: var(--shadow); }
  .dash-header nav.open { display: flex; }
  .dash-header nav a { padding: 13px 14px; border-bottom: 1px solid #edf0eb; }
  .dash-header nav a::after { display: none; }
  .dash-user { justify-self: end; }
  .editor-layout, .two-panel { grid-template-columns: 1fr; }
  .create-user { position: static; }
}

@media (max-width: 760px) {
  .dash-main { width: min(100% - 24px, 1500px); padding-top: 38px; }
  .dash-user > span { display: none; }
  .dash-title { align-items: stretch; flex-direction: column; gap: 22px; }
  .dash-title h1 { font-size: clamp(42px, 14vw, 68px); }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat-grid article { min-height: 125px; }
  .panel-heading { align-items: start; flex-direction: column; }
  .panel-heading > span { text-align: left; }
  .post-row { grid-template-columns: 78px minmax(0, 1fr); }
  .post-image { width: 78px; height: 74px; }
  .post-actions { grid-column: 1 / 3; padding-top: 12px; justify-content: flex-end; border-top: 1px solid var(--line); }
  .user-list article { grid-template-columns: 42px minmax(0, 1fr); }
  .user-avatar { width: 42px; height: 42px; }
  .user-controls { grid-column: 1 / 3; align-items: stretch; flex-direction: column; }
  .inline-reset { display: grid; grid-template-columns: 1fr auto; }
  .inline-reset input { width: 100%; }
  .slug-input span { display: none; }
}

@media (max-width: 460px) {
  .dash-header { padding: 0 12px; gap: 8px; }
  .dash-logo strong { font-size: 13px; }
  .dash-user button { padding: 8px 9px; }
  .stat-grid { gap: 10px; }
  .stat-grid article { padding: 18px; }
  .stat-grid strong { font-size: 42px; }
  .editor-card, .panel { padding: 20px; border-radius: 20px; }
}
