:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #17202a;
  --muted: #667085;
  --border: #d9dee5;
  --accent: #176b55;
  --accent-hover: #105341;
  --danger: #b42318;
  --warning: #9a6700;
  --ok: #067647;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); min-width: 320px; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, .button-link {
  min-height: 36px; padding: 7px 12px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; white-space: nowrap;
}
button:hover, .button-link:hover { border-color: #98a2b3; background: #f8fafb; }
button:disabled { opacity: .55; cursor: wait; }
.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.primary:hover { color: #fff; background: var(--accent-hover); border-color: var(--accent-hover); }
.quiet { border-color: transparent; background: transparent; }
.full { width: 100%; }
.muted { color: var(--muted); margin: 4px 0 0; }
.error-text { color: var(--danger); min-height: 20px; margin: 8px 0 0; }
.eyebrow { margin: 0 0 2px; color: var(--accent); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.brand-mark {
  width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center;
  border-radius: 7px; background: #173f37; color: #fff; font-weight: 800;
}
.brand-mark.small { width: 36px; height: 36px; flex-basis: 36px; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-panel { width: min(390px, 100%); display: grid; grid-template-columns: 44px 1fr; gap: 20px 14px; }
.login-panel h1 { margin: 0; font-size: 26px; }
.login-panel form, .login-panel .error-text { grid-column: 1 / -1; }
label { display: block; font-weight: 600; margin-bottom: 7px; }
input, textarea, select {
  width: 100%; border: 1px solid var(--border); border-radius: 6px; background: var(--surface);
  padding: 9px 10px; color: var(--text); outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(23,107,85,.12); }
.login-panel input { margin-bottom: 12px; }
.topbar {
  height: 60px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand-row, .top-actions, .toolbar, .dialog-actions { display: flex; align-items: center; gap: 10px; }
.brand-row > div:last-child { display: grid; gap: 2px; }
.brand-row span { color: var(--muted); font-size: 12px; }
.service-state { display: flex; align-items: center; gap: 7px; color: var(--muted); }
.service-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.content { max-width: 1500px; margin: 0 auto; padding: 24px; }
.summary-band {
  display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); background: #173f37; color: #fff;
  border-radius: 7px; overflow: hidden; margin-bottom: 20px;
}
.summary-band div { padding: 18px 20px; border-right: 1px solid rgba(255,255,255,.14); }
.summary-band div:last-child { border-right: 0; }
.summary-band span { display: block; color: #b9d1ca; font-size: 12px; margin-bottom: 7px; }
.summary-band strong { font-size: 23px; font-weight: 650; }
.workspace { background: var(--surface); border: 1px solid var(--border); border-radius: 7px; }
.section-head { display: flex; justify-content: space-between; gap: 20px; padding: 18px 20px; }
.section-head h2, dialog h2 { margin: 0; font-size: 18px; }
.toolbar select { width: 130px; min-height: 36px; padding: 7px 9px; }
.batchbar { min-height: 49px; padding: 6px 20px; display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--border); background: #f8fafb; }
.batchbar > span:first-child { color: var(--muted); margin-right: 4px; }
.operation-state { margin-left: auto; color: var(--muted); }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; min-width: 920px; table-layout: fixed; }
th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid #eaecf0; vertical-align: middle; }
th { color: var(--muted); font-size: 12px; font-weight: 600; background: #fcfcfd; }
th:nth-child(1) { width: 22%; } th:nth-child(2) { width: 12%; } th:nth-child(3) { width: 17%; }
th:nth-child(4) { width: 13%; } th:nth-child(5) { width: 16%; } th:nth-child(6) { width: 20%; }
.right { text-align: right; }
.account-name { display: grid; gap: 3px; min-width: 0; }
.account-name strong, .account-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-name span { color: var(--muted); font-size: 12px; }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: #ecfdf3; color: var(--ok); }
.badge.cooling { color: var(--warning); background: #fffaeb; }
.badge.disabled { color: var(--danger); background: #fef3f2; }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.row-actions button { min-height: 32px; padding: 5px 9px; }
.row-actions .danger { color: var(--danger); }
.empty-state { padding: 64px 20px; text-align: center; }
.empty-state strong, .empty-state span { display: block; }
.empty-state span { color: var(--muted); margin-top: 7px; }
dialog { width: min(620px, calc(100% - 32px)); padding: 0; border: 1px solid var(--border); border-radius: 7px; box-shadow: 0 20px 50px rgba(16,24,40,.2); }
dialog::backdrop { background: rgba(16,24,40,.45); }
.dialog-head { display: flex; justify-content: space-between; padding: 20px; border-bottom: 1px solid var(--border); }
.icon-button { width: 34px; height: 34px; padding: 0; font-size: 22px; }
.login-steps { margin: 0; padding: 20px; list-style: none; display: grid; gap: 13px; }
.login-steps li { display: flex; gap: 12px; }
.login-steps li > span { width: 25px; height: 25px; flex: 0 0 25px; display: grid; place-items: center; border-radius: 50%; background: #e6f1ee; color: var(--accent); font-weight: 700; }
.login-steps p { margin: 3px 0 0; color: var(--muted); }
#trae-login-link { margin: 0 20px; }
#callback-form { padding: 20px; }
#callback-form textarea { resize: vertical; min-height: 100px; }
.dialog-actions { justify-content: flex-end; margin-top: 14px; }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: min(420px, calc(100% - 40px)); padding: 12px 15px; border-radius: 6px; background: #17202a; color: #fff; box-shadow: 0 8px 24px rgba(16,24,40,.2); }
@media (max-width: 760px) {
  .topbar { padding: 0 14px; }
  .service-state { display: none; }
  .content { padding: 14px; }
  .summary-band { grid-template-columns: repeat(2, 1fr); }
  .summary-band div { border-bottom: 1px solid rgba(255,255,255,.14); }
  .summary-band div:last-child { grid-column: 1 / -1; }
  .section-head { align-items: stretch; flex-direction: column; }
  .toolbar { display: grid; grid-template-columns: 1fr 1fr; }
  .toolbar select { width: 100%; grid-column: 1 / -1; }
  .batchbar { overflow-x: auto; }
  .operation-state { display: none; }
}
