:root {
  --ink: #18211d;
  --muted: #66716c;
  --line: #dfe5e1;
  --surface: #ffffff;
  --canvas: #f4f6f4;
  --green: #19734b;
  --green-dark: #105c3a;
  --mint: #e4f2ea;
  --coral: #c84a32;
  --shadow: 0 18px 60px rgba(25, 45, 35, 0.13);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}
button, input, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.topbar {
  height: 68px;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.wordmark { display: flex; align-items: center; gap: 11px; color: var(--ink); font-weight: 750; text-decoration: none; }
.wordmark span, .brand-mark { display: grid; place-items: center; width: 38px; height: 38px; background: var(--ink); color: white; font-size: 13px; font-weight: 800; }
.icon-text-button { display: flex; align-items: center; gap: 7px; border: 0; background: transparent; color: var(--muted); padding: 9px; }
.icon-text-button:hover { color: var(--ink); }

.workspace { width: min(1180px, calc(100% - 40px)); margin: 36px auto 70px; }
.queue-hero { display: flex; min-height: 205px; justify-content: space-between; align-items: center; padding: 42px 48px; background: var(--ink); color: white; }
.eyebrow { margin: 0 0 9px; color: #6d7a74; font-size: 12px; font-weight: 800; text-transform: uppercase; }
.queue-hero .eyebrow { color: #9bc6af; }
.queue-hero h1 { margin: 0; display: flex; align-items: baseline; gap: 12px; }
.queue-hero h1 strong { font-size: 64px; line-height: 1; }
.queue-hero h1 span { font-size: 24px; font-weight: 650; }
.queue-hero p:last-child { color: #b5c1bb; margin: 14px 0 0; }
.claim-button { min-width: 180px; min-height: 60px; padding: 0 25px; display: inline-flex; align-items: center; justify-content: center; gap: 11px; border: 0; background: #50c28a; color: #10261c; font-weight: 800; font-size: 17px; }
.claim-button:hover { background: #66d39c; }
.claim-button:disabled { cursor: not-allowed; opacity: .45; }
.claim-button.loading { color: transparent; position: relative; }
.claim-button.loading::after { content: ""; position: absolute; width: 19px; height: 19px; border: 2px solid #183025; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.content-grid { display: grid; grid-template-columns: minmax(320px, .85fr) minmax(420px, 1.35fr); gap: 28px; margin-top: 28px; align-items: start; }
.section-block { background: var(--surface); border: 1px solid var(--line); padding: 28px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.section-heading h2, .dialog-head h2, .panel-heading h2 { margin: 0; font-size: 21px; }
.count-badge { min-width: 34px; height: 28px; display: grid; place-items: center; padding: 0 9px; background: var(--mint); color: var(--green-dark); font-size: 13px; font-weight: 800; border-radius: 14px; }

.upload-form { display: grid; gap: 16px; }
.file-drop { min-height: 104px; display: flex; align-items: center; justify-content: center; gap: 14px; border: 1px dashed #aebbb4; background: #f9fbf9; cursor: pointer; text-align: left; }
.file-drop:hover { border-color: var(--green); background: #f3faf6; }
.file-drop svg { width: 28px; height: 28px; color: var(--green); }
.file-drop span { display: grid; gap: 3px; }
.file-drop small { color: var(--muted); }
.file-drop input { display: none; }
.or-divider { height: 1px; background: var(--line); text-align: center; margin: 4px 0; }
.or-divider span { position: relative; top: -10px; padding: 0 9px; background: white; color: var(--muted); font-size: 12px; }
textarea, .stack-form input { width: 100%; border: 1px solid #cfd7d2; background: white; color: var(--ink); padding: 13px 14px; outline: none; resize: vertical; }
textarea:focus, .stack-form input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(25,115,75,.1); }
.primary-button, .secondary-button { border: 0; min-height: 46px; padding: 0 18px; font-weight: 750; }
.primary-button { background: var(--green); color: white; }
.primary-button:hover { background: var(--green-dark); }
.secondary-button { background: var(--ink); color: white; }
.secondary-button:hover { background: #2c3933; }
.full { width: 100%; }

.account-list { display: grid; }
.account-row { display: grid; grid-template-columns: 1fr auto; align-items: stretch; border-top: 1px solid var(--line); }
.account-row:last-child { border-bottom: 1px solid var(--line); }
.account-view { min-width: 0; display: grid; grid-template-columns: 40px minmax(0,1fr) 20px; gap: 12px; align-items: center; border: 0; background: white; padding: 14px 10px 14px 4px; text-align: left; color: var(--ink); }
.account-view:hover { background: #f7faf8; }
.account-view > span:nth-child(2) { min-width: 0; display: grid; gap: 4px; }
.account-view strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.account-view small { color: var(--muted); font-size: 11px; }
.account-avatar { width: 38px; height: 38px; display: grid; place-items: center; background: var(--mint); color: var(--green-dark); font-weight: 800; }
.account-view > svg { color: #89938e; }
.account-row form { display: flex; }
.restore-button { display: flex; align-items: center; gap: 7px; border: 0; background: white; color: var(--muted); padding: 0 10px; }
.restore-button:hover { color: var(--green); background: #f7faf8; }
.restore-button svg { width: 17px; }
.restore-button span { font-size: 12px; }
.empty-state { min-height: 180px; display: grid; place-content: center; justify-items: center; color: #87918c; }
.empty-state svg { width: 34px; height: 34px; }
.empty-state p { margin: 12px 0 0; }

.account-dialog { width: min(620px, calc(100% - 28px)); border: 0; padding: 28px; color: var(--ink); box-shadow: var(--shadow); }
.account-dialog::backdrop { background: rgba(15,25,20,.65); }
.dialog-head { display: flex; align-items: start; justify-content: space-between; margin-bottom: 24px; }
.close-button { width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: #eff2f0; color: var(--ink); }
.credential-block { position: relative; border: 1px solid var(--line); padding: 18px; margin-bottom: 14px; }
.credential-label { display: flex; justify-content: space-between; margin-bottom: 12px; }
.credential-label span { font-weight: 750; }
.credential-label small { color: var(--muted); }
.credential-block pre { margin: 0 0 14px; padding: 14px; max-height: 128px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; background: #f4f6f4; color: #243129; font: 13px/1.6 Consolas, monospace; }
.copy-button { display: inline-flex; align-items: center; gap: 7px; border: 1px solid #bdc8c2; background: white; min-height: 38px; padding: 0 12px; color: var(--ink); font-size: 13px; font-weight: 700; }
.copy-button:hover { border-color: var(--green); color: var(--green); }
.copy-button svg { width: 17px; }

.notice { margin-bottom: 18px; padding: 13px 15px; border-left: 3px solid var(--green); background: var(--mint); color: var(--green-dark); font-size: 14px; }
.notice.error { border-color: var(--coral); background: #fae9e5; color: #84311f; }
.toast { position: fixed; right: 24px; bottom: 24px; transform: translateY(18px); opacity: 0; pointer-events: none; background: var(--ink); color: white; padding: 12px 16px; box-shadow: var(--shadow); transition: .2s ease; }
.toast.error { background: #8c3020; }
.toast.visible { opacity: 1; transform: translateY(0); }

.login-page { min-height: 100vh; background: #edf1ee; display: grid; place-items: center; padding: 24px; }
.login-shell { width: min(920px, 100%); min-height: 520px; display: grid; grid-template-columns: 1.15fr .85fr; background: white; box-shadow: var(--shadow); }
.login-brand { padding: 60px; display: flex; flex-direction: column; justify-content: flex-end; background: var(--ink); color: white; }
.login-brand .brand-mark { width: 54px; height: 54px; background: #50c28a; color: #10261c; margin-bottom: auto; }
.login-brand h1 { margin: 0 0 10px; font-size: 42px; }
.login-brand p { margin: 0; color: #b9c4be; }
.login-panel { padding: 52px 42px; display: flex; flex-direction: column; justify-content: center; }
.panel-heading { margin-bottom: 26px; }
.stack-form { display: grid; gap: 18px; }
.stack-form label { display: grid; gap: 8px; color: #39443f; font-size: 13px; font-weight: 700; }

@media (max-width: 780px) {
  .topbar { padding: 0 18px; }
  .workspace { width: min(100% - 24px, 620px); margin-top: 18px; }
  .queue-hero { min-height: 240px; padding: 28px; align-items: flex-start; flex-direction: column; }
  .queue-hero h1 strong { font-size: 54px; }
  .claim-button { width: 100%; }
  .content-grid { grid-template-columns: 1fr; gap: 18px; margin-top: 18px; }
  .section-block { padding: 20px; }
  .login-shell { min-height: 0; grid-template-columns: 1fr; }
  .login-brand { min-height: 220px; padding: 30px; }
  .login-brand h1 { font-size: 32px; }
  .login-brand .brand-mark { margin-bottom: 50px; }
  .login-panel { padding: 34px 28px; }
  .restore-button span { display: none; }
  .account-dialog { padding: 20px; }
}

