:root {
  --ink: #17241f;
  --forest: #14382f;
  --forest-2: #205146;
  --lime: #ddf58b;
  --coral: #ff8a5b;
  --cream: #f6f4ec;
  --paper: #fffef9;
  --line: #dedfd7;
  --muted: #69756f;
  --success: #2d8066;
  --warning: #b86c2b;
  --danger: #b8493f;
  --shadow: 0 20px 60px rgba(20, 56, 47, 0.12);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--cream); }
body { margin: 0; color: var(--ink); background: var(--cream); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
[hidden] { display: none !important; }

.eyebrow { margin: 0 0 14px; color: var(--lime); font-size: 11px; font-weight: 800; letter-spacing: .18em; }
.eyebrow.ink { color: var(--forest-2); }
.muted { color: var(--muted); }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--forest); font-size: 19px; font-weight: 800; letter-spacing: -.03em; text-decoration: none; }
.brand img { width: 38px; height: 38px; }
.brand-light { color: white; }

.login-view { display: grid; grid-template-columns: minmax(420px, 1.15fr) minmax(440px, .85fr); min-height: 100vh; }
.login-story { position: relative; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; padding: 46px 7vw 42px; color: white; background: var(--forest); }
.login-story::before { content: ""; position: absolute; width: 580px; height: 580px; right: -150px; top: -130px; border: 1px solid rgba(221,245,139,.18); border-radius: 50%; box-shadow: 0 0 0 80px rgba(221,245,139,.04), 0 0 0 160px rgba(221,245,139,.025); }
.login-story::after { content: ""; position: absolute; width: 190px; height: 190px; right: 15%; bottom: 13%; background: radial-gradient(circle at 50% 50%, var(--coral) 0 3px, transparent 4px), radial-gradient(circle at 50% 50%, transparent 0 48%, rgba(255,138,91,.5) 49% 50%, transparent 51%); background-size: 28px 28px, 100% 100%; opacity: .42; transform: rotate(8deg); }
.login-story > * { position: relative; z-index: 1; }
.story-copy { max-width: 700px; margin: 12vh 0; }
.story-copy h1 { max-width: 680px; margin: 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(42px, 5.2vw, 78px); font-weight: 500; line-height: 1.08; letter-spacing: -.055em; }
.story-copy > p:last-child { max-width: 580px; margin: 30px 0 0; color: #c7d7d0; font-size: 17px; line-height: 1.8; }
.story-status { display: flex; align-items: center; gap: 10px; color: #d8e3de; font-size: 13px; }
.story-status strong { margin-left: 5px; padding: 5px 9px; color: var(--lime); border: 1px solid rgba(221,245,139,.35); border-radius: 99px; font-size: 10px; letter-spacing: .1em; }
.pulse-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 5px rgba(221,245,139,.12); }

.login-panel { display: grid; place-items: center; padding: 50px; background: var(--paper); }
.login-card { display: grid; gap: 22px; width: min(100%, 470px); }
.login-card h2 { margin: 0 0 10px; font-family: Georgia, "Songti SC", serif; font-size: 38px; font-weight: 500; letter-spacing: -.035em; }
.login-card p { margin-top: 0; line-height: 1.6; }
label { display: grid; gap: 8px; color: #43504a; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; color: var(--ink); background: white; border: 1px solid #d4d8d3; border-radius: 10px; outline: none; transition: border .2s, box-shadow .2s; }
input, select { height: 48px; padding: 0 14px; }
textarea { min-height: 110px; padding: 13px 14px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: var(--forest-2); box-shadow: 0 0 0 3px rgba(32,81,70,.1); }
.input-wrap { position: relative; display: block; }
.input-wrap input { padding-right: 64px; }
.text-button { position: absolute; top: 50%; right: 9px; padding: 7px; background: none; border: 0; transform: translateY(-50%); color: var(--forest-2); font-size: 12px; font-weight: 800; cursor: pointer; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 42px; padding: 0 17px; border: 1px solid transparent; border-radius: 9px; font-size: 13px; font-weight: 800; cursor: pointer; transition: transform .15s, opacity .15s, background .15s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.button-large { min-height: 52px; justify-content: space-between; padding: 0 18px; }
.button-primary { color: white; background: var(--forest); }
.button-primary:hover { background: var(--forest-2); }
.button-accent { color: var(--forest); background: var(--lime); }
.button-ghost { color: var(--forest); background: white; border-color: var(--line); }
.button-danger { color: var(--danger); background: #fff4f1; border-color: #f1c8bf; }
.button-small { min-height: 34px; padding: 0 12px; font-size: 12px; }
.docs-link { justify-self: center; color: var(--forest-2); font-size: 13px; font-weight: 700; text-decoration: none; }
.form-error { min-height: 18px; margin: -8px 0 0; color: var(--danger); font-size: 12px; line-height: 1.5; }

.app-view { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 28px 20px 22px; background: var(--paper); border-right: 1px solid var(--line); z-index: 10; }
.sidebar .brand { margin: 0 8px 34px; }
.sidebar nav { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 13px; color: #69746f; background: transparent; border: 0; border-radius: 9px; font-size: 13px; font-weight: 700; text-align: left; cursor: pointer; }
.nav-item span { display: grid; place-items: center; width: 18px; font-size: 17px; }
.nav-item:hover { color: var(--forest); background: #f0f1eb; }
.nav-item.is-active { color: white; background: var(--forest); box-shadow: 0 8px 24px rgba(20,56,47,.16); }
.sidebar-foot { display: grid; gap: 15px; margin-top: auto; }
.environment-chip { display: flex; align-items: center; gap: 10px; padding: 13px; background: #f0f4ed; border-radius: 10px; }
.environment-chip > span { width: 9px; height: 9px; flex: 0 0 auto; background: var(--success); border-radius: 50%; }
.environment-chip div { display: grid; gap: 2px; }
.environment-chip small { color: var(--muted); font-size: 10px; }
.environment-chip strong { font-size: 12px; }
.logout-button { border-top: 1px solid var(--line); border-radius: 0; padding-top: 10px; }

.workspace { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 8; display: flex; align-items: center; justify-content: space-between; min-height: 98px; padding: 20px clamp(24px, 4vw, 60px); background: rgba(246,244,236,.9); border-bottom: 1px solid rgba(222,223,215,.8); backdrop-filter: blur(18px); }
.topbar h1 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 30px; font-weight: 500; letter-spacing: -.035em; }
.topbar .eyebrow { margin-bottom: 6px; font-size: 9px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.connection-status { display: flex; align-items: center; gap: 8px; padding: 8px 11px; color: var(--muted); background: rgba(255,255,255,.65); border: 1px solid var(--line); border-radius: 99px; font-size: 11px; font-weight: 700; }
.connection-status span { width: 7px; height: 7px; border-radius: 50%; background: #aab1ad; }
.connection-status.is-online span { background: var(--success); box-shadow: 0 0 0 3px rgba(45,128,102,.12); }
.connection-status.is-offline span { background: var(--danger); }
.icon-button { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; background: white; border: 1px solid var(--line); border-radius: 50%; font-size: 18px; cursor: pointer; }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; color: var(--lime); background: var(--forest); border-radius: 50%; font-size: 11px; font-weight: 900; }
.mobile-menu { display: none; width: 38px; height: 38px; background: transparent; border: 0; font-size: 20px; }
.page-content { width: min(100%, 1440px); margin: 0 auto; padding: 34px clamp(24px, 4vw, 60px) 70px; outline: none; }

.hero-strip { position: relative; overflow: hidden; display: grid; grid-template-columns: 1.6fr .8fr; gap: 30px; min-height: 220px; padding: 34px; color: white; background: var(--forest); border-radius: 16px; box-shadow: var(--shadow); }
.hero-strip::after { content: ""; position: absolute; right: -50px; bottom: -160px; width: 370px; height: 370px; border: 1px solid rgba(221,245,139,.2); border-radius: 50%; box-shadow: 0 0 0 55px rgba(221,245,139,.04), 0 0 0 110px rgba(221,245,139,.02); }
.hero-strip > * { position: relative; z-index: 1; }
.hero-strip h2 { max-width: 620px; margin: 0 0 16px; font-family: Georgia, "Songti SC", serif; font-size: clamp(29px, 3vw, 44px); font-weight: 500; line-height: 1.2; letter-spacing: -.04em; }
.hero-strip p { max-width: 620px; margin: 0; color: #bdd0c8; line-height: 1.7; }
.hero-safety { align-self: end; display: grid; gap: 9px; padding: 18px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); border-radius: 12px; }
.hero-safety span { color: var(--lime); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.hero-safety strong { font-size: 16px; }
.hero-safety small { color: #b9cdc5; line-height: 1.5; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 18px 0 30px; }
.stat-card { position: relative; overflow: hidden; min-height: 138px; padding: 22px; background: var(--paper); border: 1px solid var(--line); border-radius: 13px; }
.stat-card .stat-label { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.stat-card strong { display: block; margin: 15px 0 8px; font-family: Georgia, serif; font-size: 34px; font-weight: 500; }
.stat-card small { color: var(--muted); font-size: 11px; }
.stat-card .stat-mark { position: absolute; right: 18px; top: 18px; display: grid; place-items: center; width: 29px; height: 29px; color: var(--forest); background: #edf2e3; border-radius: 50%; }

.section { margin-top: 30px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.section-head h2 { margin: 0 0 4px; font-family: Georgia, "Songti SC", serif; font-size: 23px; font-weight: 500; letter-spacing: -.025em; }
.section-head p { margin: 0; color: var(--muted); font-size: 12px; }
.section-actions { display: flex; gap: 8px; }
.two-column { display: grid; grid-template-columns: 1.25fr .75fr; gap: 18px; }
.panel { padding: 22px; background: var(--paper); border: 1px solid var(--line); border-radius: 13px; }
.panel-flush { overflow: hidden; padding: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.panel-head h3 { margin: 0; font-size: 14px; }
.status-pill { display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px; color: var(--forest-2); background: #e9f3e7; border-radius: 99px; font-size: 10px; font-weight: 900; letter-spacing: .04em; }
.status-pill.warning { color: #8c501e; background: #fff0dc; }
.status-pill.danger { color: var(--danger); background: #fce7e2; }
.status-pill.neutral { color: #606b65; background: #eceee9; }

.account-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 15px; }
.account-card { padding: 22px; background: var(--paper); border: 1px solid var(--line); border-radius: 13px; }
.account-top { display: flex; align-items: center; gap: 13px; }
.platform-icon { display: grid; place-items: center; width: 43px; height: 43px; color: white; background: #2866b1; border-radius: 11px; font-size: 17px; font-weight: 900; }
.platform-icon.youtube { background: #d8493f; }
.account-top h3 { margin: 0 0 4px; font-size: 14px; }
.account-top p { margin: 0; color: var(--muted); font-size: 11px; }
.account-top .status-pill { margin-left: auto; }
.account-meta { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; margin: 20px 0; }
.meta-box { padding: 11px; background: #f5f5ef; border-radius: 8px; }
.meta-box small { display: block; margin-bottom: 5px; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.meta-box strong { font-size: 11px; word-break: break-all; }
.capability-list { display: flex; flex-wrap: wrap; gap: 6px; min-height: 29px; margin-bottom: 17px; }
.capability { padding: 5px 7px; color: #4e6159; background: #edf0e9; border-radius: 5px; font-size: 9px; font-weight: 700; }
.account-actions { display: flex; gap: 8px; }

.timeline { display: grid; }
.timeline-item { display: grid; grid-template-columns: 28px 1fr; gap: 12px; min-height: 60px; }
.timeline-rail { position: relative; display: flex; justify-content: center; }
.timeline-rail::after { content: ""; position: absolute; top: 22px; bottom: 0; width: 1px; background: var(--line); }
.timeline-item:last-child .timeline-rail::after { display: none; }
.timeline-dot { position: relative; z-index: 1; display: grid; place-items: center; width: 23px; height: 23px; color: var(--forest); background: var(--lime); border-radius: 50%; font-size: 10px; font-weight: 900; }
.timeline-copy { padding: 2px 0 20px; }
.timeline-copy strong { display: block; margin-bottom: 4px; font-size: 12px; }
.timeline-copy small { color: var(--muted); font-size: 10px; }

.empty-state { display: grid; place-items: center; min-height: 260px; padding: 40px; text-align: center; }
.empty-state .empty-icon { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 18px; color: var(--forest); background: #eef1e7; border-radius: 50%; font-size: 27px; }
.empty-state h3 { margin: 0 0 8px; font-family: Georgia, "Songti SC", serif; font-size: 22px; font-weight: 500; }
.empty-state p { max-width: 440px; margin: 0 0 20px; color: var(--muted); font-size: 12px; line-height: 1.65; }

.form-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-panel .span-2 { grid-column: span 2; }
.form-actions { display: flex; justify-content: flex-end; }
.draft-list { display: grid; gap: 12px; }
.draft-card { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 20px; padding: 20px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.draft-card h3 { margin: 0 0 9px; font-size: 14px; }
.draft-card p { margin: 0 0 13px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.draft-meta { display: flex; flex-wrap: wrap; gap: 7px; }
.draft-actions { display: flex; align-items: center; gap: 7px; }
.code-preview { max-width: 650px; overflow: hidden; padding: 9px 11px; color: #52605a; background: #f3f4ef; border-radius: 7px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

.safety-banner { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding: 15px 18px; color: #6f451d; background: #fff2df; border: 1px solid #f0d5ad; border-radius: 11px; }
.safety-banner > span { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 auto; background: #ffd99d; border-radius: 50%; font-weight: 900; }
.safety-banner strong { display: block; margin-bottom: 3px; font-size: 12px; }
.safety-banner small { font-size: 10px; line-height: 1.4; }
.control-card { display: flex; align-items: center; justify-content: space-between; gap: 25px; padding: 24px; color: white; background: var(--forest); border-radius: 13px; }
.control-card h3 { margin: 0 0 6px; font-size: 16px; }
.control-card p { margin: 0; color: #bed0c9; font-size: 11px; }
.control-actions { display: flex; gap: 8px; flex: 0 0 auto; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 11px; text-align: left; vertical-align: middle; }
th { color: var(--muted); background: #f6f6f0; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafaf5; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }

.dialog { width: min(92vw, 560px); padding: 0; background: var(--paper); border: 0; border-radius: 15px; box-shadow: 0 30px 100px rgba(8,35,28,.3); }
.dialog::backdrop { background: rgba(11,35,29,.55); backdrop-filter: blur(5px); }
.dialog form { padding: 24px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.dialog-head h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 25px; font-weight: 500; }
.dialog-body-grid { display: grid; gap: 15px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.toast-region { position: fixed; z-index: 100; right: 24px; bottom: 24px; display: grid; gap: 8px; }
.toast { width: min(380px, calc(100vw - 48px)); padding: 14px 16px; color: white; background: var(--forest); border-radius: 10px; box-shadow: var(--shadow); font-size: 12px; line-height: 1.5; animation: toast-in .25s ease-out; }
.toast.error { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.skeleton { overflow: hidden; min-height: 100px; background: linear-gradient(90deg,#eee 20%,#f8f8f4 45%,#eee 70%); background-size: 300% 100%; border-radius: 12px; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -150% 0; } }

@media (max-width: 1050px) {
  .login-view { grid-template-columns: 1fr 1fr; }
  .login-story { padding: 40px; }
  .story-copy h1 { font-size: 47px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .two-column { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
  .login-view { display: block; background: var(--paper); }
  .login-story { min-height: 310px; padding: 28px 24px; }
  .story-copy { margin: 45px 0 30px; }
  .story-copy h1 { font-size: 38px; }
  .story-copy > p:last-child { margin-top: 17px; font-size: 14px; }
  .login-panel { padding: 38px 24px 55px; }
  .login-card h2 { font-size: 31px; }
  .app-view { display: block; }
  .sidebar { position: fixed; left: 0; width: 260px; transform: translateX(-101%); transition: transform .22s; box-shadow: 15px 0 50px rgba(20,56,47,.14); }
  .sidebar.is-open { transform: translateX(0); }
  .mobile-menu { display: grid; place-items: center; }
  .topbar { min-height: 82px; padding: 15px 18px; }
  .topbar > div:first-of-type { flex: 1; }
  .topbar h1 { font-size: 24px; }
  .connection-status { display: none; }
  .page-content { padding: 24px 18px 55px; }
  .hero-strip { grid-template-columns: 1fr; padding: 25px; }
  .stat-grid, .account-grid { grid-template-columns: 1fr; }
  .form-panel { grid-template-columns: 1fr; }
  .form-panel .span-2 { grid-column: auto; }
  .draft-card { grid-template-columns: 1fr; }
  .draft-actions { flex-wrap: wrap; }
  .control-card { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 480px) {
  .field-row { grid-template-columns: 1fr; }
  .story-copy h1 { font-size: 32px; }
  .stat-grid { grid-template-columns: 1fr; }
  .top-actions .avatar { display: none; }
  .account-meta { grid-template-columns: 1fr; }
  .section-head { align-items: flex-start; flex-direction: column; }
}
