:root {
  --bg: #080d0f;
  --sidebar: #0b1114;
  --surface: #10181c;
  --surface-2: #152126;
  --surface-3: #1a292e;
  --border: #26363b;
  --border-strong: #395158;
  --text: #ecf4f2;
  --muted: #91a5a2;
  --faint: #637875;
  --teal: #29d7b1;
  --teal-dark: #0f4d42;
  --blue: #55aef3;
  --amber: #f4bd61;
  --red: #ef7a7a;
  --success: #67d49b;
  --shadow: 0 18px 45px rgb(0 0 0 / 24%);
  font-family: "Segoe UI", "Microsoft YaHei UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); color: var(--text); }
button, input, textarea { font: inherit; letter-spacing: 0; }
button { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.official-logo { display: block; height: auto; object-fit: contain; }

.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #080d0f; }
.login-panel { width: min(390px, 100%); padding: 34px; border: 1px solid var(--border); border-top: 3px solid var(--teal); background: var(--surface); box-shadow: var(--shadow); border-radius: 6px; animation: rise .38s ease-out both; }
.brand-mark { color: var(--teal); font-weight: 800; font-size: 13px; letter-spacing: 0; }
.login-logo { width: 176px; margin-bottom: 22px; }
.login-panel h1 { margin: 0 0 4px; font-size: 25px; letter-spacing: 0; }
.login-panel form { margin-top: 30px; }
label { display: grid; gap: 8px; color: var(--muted); font-size: 13px; }
input, textarea { width: 100%; border: 1px solid var(--border); border-radius: 4px; color: var(--text); background: #0b1215; padding: 11px 12px; outline: none; transition: border-color .18s, box-shadow .18s; }
input:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgb(41 215 177 / 12%); }
textarea { resize: vertical; line-height: 1.65; }
.password-row { display: grid; grid-template-columns: 1fr 42px; gap: 7px; margin-bottom: 14px; }
.form-error { min-height: 20px; margin: 12px 0 0; color: var(--red); font-size: 12px; }

.product-hub { min-height: 100vh; background: var(--bg); }
.hub-topbar { height: 76px; padding: 0 clamp(20px, 4vw, 54px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); background: var(--sidebar); }
.hub-brand { display: flex; align-items: center; gap: 18px; }
.hub-brand span { padding-left: 18px; border-left: 1px solid var(--border-strong); color: var(--muted); font-size: 14px; }
.hub-logo { width: 138px; }
.hub-content { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 64px 0; }
.hub-heading { margin-bottom: 30px; }
.hub-heading h1 { margin: 8px 0 7px; font-size: 32px; letter-spacing: 0; }
.hub-heading p:last-child { margin: 0; }
.product-grid { display: grid; grid-template-columns: repeat(3, minmax(240px, 1fr)); gap: 14px; }
.product-card { min-height: 116px; display: grid; grid-template-columns: 52px minmax(0, 1fr) auto 22px; align-items: center; gap: 16px; padding: 20px; border: 1px solid var(--border); border-radius: 6px; color: var(--text); background: var(--surface); text-align: left; cursor: pointer; transition: border-color .18s, background .18s, transform .18s; }
.product-card:hover { border-color: var(--teal); background: var(--surface-2); transform: translateY(-2px); }
.product-card:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
.product-icon { width: 52px; height: 52px; display: grid; place-items: center; border: 1px solid var(--border-strong); color: var(--teal); background: #0b1215; }
.product-icon svg { width: 24px; height: 24px; }
.product-copy { min-width: 0; display: grid; gap: 7px; }
.product-copy strong { font-size: 16px; }
.product-copy small { color: var(--muted); line-height: 1.45; }
.product-state { padding: 5px 7px; border-radius: 3px; color: var(--success); background: rgb(103 212 155 / 10%); font: 700 10px/1 "Consolas", monospace; }
.product-arrow { width: 18px; color: var(--blue); transition: transform .18s; }
.product-card:hover .product-arrow { transform: translateX(3px); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--sidebar); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 24px 14px 14px; z-index: 20; }
.brand { display: grid; gap: 12px; padding: 0 13px 25px; }
.sidebar-logo { width: 128px; }
.brand strong { font-size: 16px; }
nav { display: grid; gap: 5px; }
.nav-item { appearance: none; width: 100%; height: 44px; display: flex; align-items: center; gap: 11px; padding: 0 13px; border: 0; border-left: 2px solid transparent; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; text-align: left; transition: background .18s, color .18s, transform .18s; }
.nav-item svg { width: 18px; height: 18px; }
.nav-item:hover { color: var(--text); background: var(--surface-2); transform: translateX(2px); }
.nav-item.active { color: var(--teal); background: rgb(41 215 177 / 8%); border-left-color: var(--teal); }
.sidebar-mascot { flex: 1; min-height: 120px; margin: 10px -14px 0; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; pointer-events: none; }
.sidebar-mascot img { width: min(210px, 96%); max-height: 100%; object-fit: contain; object-position: center bottom; opacity: .76; filter: drop-shadow(0 10px 18px rgb(0 0 0 / 34%)); }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding: 14px 8px 0; display: flex; align-items: center; justify-content: space-between; }
.version { font: 700 10px/1 "Consolas", monospace; color: var(--faint); }

.workspace { min-width: 0; padding: 0 32px 38px; }
.topbar { height: 92px; display: flex; align-items: center; gap: 14px; border-bottom: 1px solid var(--border); margin-bottom: 26px; }
.topbar h2 { margin: 3px 0 0; font-size: 22px; }
.eyebrow, .panel-kicker { margin: 0; font: 700 10px/1.2 "Consolas", monospace; color: var(--teal); }
.service-indicator { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.service-indicator span { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 5px rgb(103 212 155 / 10%); animation: breathe 2.2s ease-in-out infinite; }
.view { display: none; animation: viewIn .3s ease-out both; }
.view.active { display: block; }
.two-column { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr); gap: 16px; }
.panel { border: 1px solid var(--border); background: var(--surface); border-radius: 6px; }
.panel-heading, .progress-head, .section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel-heading { padding: 18px 20px; border-bottom: 1px solid var(--border); }
.panel h3, .section-title-row h3, .dialog h3 { margin: 5px 0 0; font-size: 16px; }
.count-badge, .status { white-space: nowrap; padding: 5px 8px; border-radius: 3px; color: var(--blue); background: rgb(85 174 243 / 10%); font: 700 10px/1 "Consolas", monospace; }
.status.success { color: var(--success); background: rgb(103 212 155 / 10%); }

.drop-zone { margin: 18px 20px 12px; min-height: 150px; border: 1px dashed var(--border-strong); display: grid; place-items: center; align-content: center; gap: 8px; color: var(--muted); cursor: pointer; transition: border-color .18s, background .18s; }
.drop-zone:hover, .drop-zone.dragging { border-color: var(--teal); background: rgb(41 215 177 / 5%); }
.drop-zone svg { width: 28px; height: 28px; color: var(--teal); }
.drop-zone strong { color: var(--text); font-size: 14px; }
.drop-zone span { font: 700 10px/1 "Consolas", monospace; color: var(--faint); }
.drop-zone input, .file-button input { display: none; }
.file-list { padding: 0 20px 16px; display: grid; gap: 6px; max-height: 142px; overflow: auto; }
.file-row { min-height: 34px; display: grid; grid-template-columns: 20px minmax(0, 1fr) auto 28px; align-items: center; gap: 8px; color: var(--muted); border-bottom: 1px solid rgb(38 54 59 / 65%); font-size: 12px; }
.file-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row small { color: var(--faint); }

.meeting-panel { padding-bottom: 20px; }
.form-grid { display: grid; gap: 16px; padding: 20px; }
.pipeline { margin: 0 20px 20px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.stage { min-height: 34px; display: grid; place-items: center; background: var(--surface-2); color: var(--faint); font-size: 10px; font-weight: 700; }
.stage.active { color: var(--teal); border-bottom: 2px solid var(--teal); }
.primary, .secondary, .file-button { min-height: 40px; border-radius: 4px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; cursor: pointer; transition: transform .15s, filter .15s, border-color .15s, background .15s; }
.primary { background: var(--teal); color: #04110f; font-weight: 700; }
.primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.primary:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.secondary, .file-button { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.secondary:hover, .file-button:hover { border-color: var(--border-strong); background: var(--surface-3); }
.primary svg, .secondary svg, .file-button svg { width: 17px; height: 17px; }
.full { width: calc(100% - 40px); margin: 0 20px; }
.icon-button { width: 38px; height: 38px; flex: 0 0 38px; display: inline-grid; place-items: center; padding: 0; border: 1px solid var(--border); border-radius: 4px; background: transparent; cursor: pointer; }
.icon-button:hover { background: var(--surface-2); border-color: var(--border-strong); }
.icon-button svg { width: 17px; height: 17px; }

.progress-panel, .result-panel { margin-top: 16px; padding: 20px; }
.progress-head h3 { margin-top: 4px; }
.progress-head strong { font: 700 22px/1 "Consolas", monospace; color: var(--teal); }
.progress-track { height: 5px; margin: 18px 0 12px; background: var(--surface-3); overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--teal); transition: width .45s ease; }
.job-logs { max-height: 160px; overflow: auto; margin-top: 14px; padding: 12px; background: #090f11; color: var(--muted); font: 11px/1.7 "Consolas", monospace; }
.download-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.download-item { min-height: 72px; display: flex; align-items: center; gap: 13px; padding: 12px; text-align: left; color: var(--text); border: 1px solid var(--border); background: var(--surface-2); border-radius: 4px; cursor: pointer; }
.download-item:hover { border-color: var(--teal); }
.download-item svg { width: 22px; color: var(--teal); }
.download-item span { display: grid; gap: 4px; }
.download-item small { color: var(--faint); }

.toolbar { min-height: 64px; padding: 11px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.toolbar-group { display: flex; align-items: center; gap: 7px; }
.section-title-row { margin: 26px 2px 12px; }
.section-title-row p { margin: 0; font-size: 12px; }
.table-wrap { border: 1px solid var(--border); border-radius: 6px; overflow: auto; background: var(--surface); }
.email-table { width: 100%; min-width: 930px; border-collapse: collapse; table-layout: fixed; }
.email-table th { height: 42px; padding: 0 10px; color: var(--faint); background: #0c1316; border-bottom: 1px solid var(--border); text-align: left; font-size: 11px; font-weight: 700; }
.email-table td { height: 54px; padding: 9px 10px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 12px; vertical-align: middle; }
.email-table tr:last-child td { border-bottom: 0; }
.email-table tbody tr { transition: background .15s; }
.email-table tbody tr:hover { background: rgb(41 215 177 / 3%); }
.email-table th:nth-child(2) { width: 90px; }
.email-table th:nth-child(3) { width: 220px; }
.email-table th:nth-child(5) { width: 95px; }
.email-table th:nth-child(6) { width: 110px; }
.check-col, .action-col { width: 48px; text-align: center !important; }
.task-cell { color: var(--text) !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-check { width: 17px; height: 17px; accent-color: var(--teal); }
.row-status { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--amber); }
.row-status.sent { color: var(--success); }
.empty-state { min-height: 140px; display: grid; place-items: center; color: var(--faint); text-align: center; }
td.empty-state { height: 180px; }

.feishu-panel { min-height: 150px; display: grid; grid-template-columns: 86px minmax(0, 1fr) auto; align-items: center; gap: 20px; padding: 24px; }
.feishu-symbol { width: 70px; height: 70px; display: grid; place-items: center; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--blue); font-weight: 800; }
.feishu-copy h3 { margin: 0 0 8px; }
.feishu-copy p { margin: 0; }
.feishu-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.feishu-import-panel { margin-top: 14px; }
.import-hint { font-size: 12px; }
.feishu-import-form { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(180px, 1fr) auto; align-items: end; gap: 10px; padding: 18px 20px 20px; }
.file-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-picker span { min-height: 42px; display: flex; align-items: center; padding: 0 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid var(--border); border-radius: 4px; color: var(--text); background: #0b1215; cursor: pointer; }
.file-picker span:hover { border-color: var(--teal); }
.notice { margin-top: 14px; padding: 14px 16px; border: 1px solid var(--border); border-left: 3px solid var(--teal); background: var(--surface); border-radius: 4px; }
.notice.error { border-left-color: var(--red); color: var(--red); }
.notice a { color: var(--blue); }

.job-list { display: grid; gap: 8px; }
.job-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 14px; min-height: 72px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); }
.job-actions { display: flex; align-items: center; gap: 7px; }
.job-item:hover { border-color: var(--border-strong); }
.job-main { min-width: 0; }
.job-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-main small { display: block; margin-top: 6px; color: var(--faint); }
.job-state { color: var(--amber); font-size: 11px; }
.job-state.done { color: var(--success); }
.job-state.failed { color: var(--red); }
.config-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.settings-note { margin: -3px 2px 16px; color: var(--muted); font-size: 12px; }
.config-item { min-height: 150px; padding: 20px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); display: flex; flex-direction: column; }
.config-head { min-height: 30px; display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 9px; margin-bottom: 18px; }
.config-head svg { width: 20px; color: var(--blue); }
.config-head h3 { margin: 0; }
.config-status { padding: 5px 7px; border-radius: 3px; color: var(--faint); background: var(--surface-2); font: 700 10px/1 "Consolas", monospace; }
.config-status.ready { color: var(--success); background: rgb(103 212 155 / 10%); }
.config-fields { display: grid; gap: 13px; }
.config-fields label { gap: 6px; }
.config-fields input { min-width: 0; }
.config-test { align-self: flex-start; margin-top: 18px; }

.dialog { width: min(760px, calc(100% - 28px)); max-height: calc(100vh - 30px); padding: 0; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgb(0 0 0 / 68%); backdrop-filter: blur(3px); }
.dialog form { margin: 0; }
.dialog-head { min-height: 70px; padding: 14px 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); }
.dialog-fields { padding: 20px; display: grid; grid-template-columns: 1fr; gap: 14px; max-height: calc(100vh - 170px); overflow: auto; }
.dialog-fields textarea { min-height: 250px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: grid; gap: 8px; width: min(360px, calc(100% - 40px)); }
.toast { padding: 13px 15px; border: 1px solid var(--border-strong); border-left: 3px solid var(--teal); border-radius: 4px; color: var(--text); background: #132025; box-shadow: var(--shadow); animation: toastIn .25s ease-out both; }
.toast.error { border-left-color: var(--red); }
.mobile-only { display: none; }

@keyframes viewIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes breathe { 50% { opacity: .45; } }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 190px minmax(0, 1fr); }
  .workspace { padding-inline: 22px; }
  .two-column { grid-template-columns: 1fr; }
  .download-grid, .config-grid { grid-template-columns: 1fr; }
  .feishu-import-form { grid-template-columns: 1fr 1fr; }
  .product-grid { grid-template-columns: repeat(2, minmax(240px, 1fr)); }
  .sidebar-logo { width: 118px; }
}

@media (max-width: 720px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: -230px; width: 220px; transition: left .22s ease; box-shadow: var(--shadow); }
  .sidebar.open { left: 0; }
  .workspace { padding: 0 14px 28px; }
  .topbar { height: 76px; margin-bottom: 18px; }
  .mobile-only { display: inline-grid; }
  .service-indicator { font-size: 0; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-group { overflow-x: auto; }
  .toolbar > .primary { width: 100%; }
  .email-table { min-width: 100%; }
  .email-table th:nth-child(4), .email-table td:nth-child(4),
  .email-table th:nth-child(5), .email-table td:nth-child(5),
  .email-table th:nth-child(6), .email-table td:nth-child(6) { display: none; }
  .email-table th:nth-child(2) { width: 72px; }
  .email-table th:nth-child(3) { width: auto; }
  .email-table td:nth-child(3) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .feishu-panel { grid-template-columns: 62px minmax(0, 1fr); }
  .feishu-symbol { width: 58px; height: 58px; }
  .feishu-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .feishu-actions .primary { grid-column: 1 / -1; width: 100%; }
  .job-item { grid-template-columns: minmax(0, 1fr) auto; }
  .job-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
  .job-actions button { width: 100%; }
  .job-actions button:only-child { grid-column: 1 / -1; }
  .job-main strong { white-space: normal; overflow-wrap: anywhere; }
  .feishu-import-form { grid-template-columns: 1fr; }
  .import-hint { display: none; }
  .hub-topbar { height: 68px; padding: 0 18px; }
  .hub-logo { width: 112px; }
  .hub-brand { gap: 12px; }
  .hub-brand span { padding-left: 12px; font-size: 12px; }
  .hub-content { width: calc(100% - 28px); padding: 38px 0; }
  .hub-heading h1 { font-size: 27px; }
  .product-grid { grid-template-columns: 1fr; }
  .product-card { grid-template-columns: 48px minmax(0, 1fr) 18px; padding: 16px; }
  .product-icon { width: 48px; height: 48px; }
  .product-state { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
