:root {
  --ink: #14233b;
  --muted: #607089;
  --line: #dce5f0;
  --accent: #1769e0;
  --accent-dark: #0d4fb5;
  --pale: #e7f0ff;
  --paper: #f8fbff;
  --ok: #22744f;
  --danger: #b7473c;
  --shadow: 0 18px 55px rgba(28, 78, 145, .11);
}

* { box-sizing: border-box; }
html { background: #fff; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 8%, rgba(23, 105, 224, .08), transparent 25rem),
    radial-gradient(circle at 92% 14%, rgba(62, 131, 232, .08), transparent 28rem),
    #fff;
  font: 15px/1.6 "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .65;
  background-image:
    linear-gradient(rgba(23, 105, 224, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 105, 224, .035) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, #000, transparent 75%);
}
button, textarea, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
.shell { width: min(1180px, calc(100% - 48px)); margin: 0 auto; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 0 8px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.mark {
  width: 46px;
  height: 46px;
  border-radius: 14px 14px 14px 4px;
  background: linear-gradient(145deg, #2a7cf0, #1359c4);
  box-shadow: 0 8px 18px rgba(23, 105, 224, .2);
  display: grid;
  place-items: center;
}
.brand-name { font: 700 21px/1 Consolas, "SFMono-Regular", monospace; letter-spacing: -.06em; }
.brand-product { margin-left: 10px; color: var(--muted); font-size: 12px; font-weight: 600; }
.top-right { display: flex; align-items: center; gap: 18px; }
.tabs { display: flex; gap: 6px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.8); }
.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  min-height: 32px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 700;
}
.tab.active { color: #fff; background: var(--accent); }
.availability { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #a7a39a; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 4px rgba(34, 116, 79, .12); }
.dot.off { background: var(--danger); }

main { padding: 28px 0 72px; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 500px); gap: clamp(42px, 8vw, 118px); align-items: start; }
.eyebrow { display: flex; align-items: center; gap: 9px; margin: 0 0 18px; color: var(--accent); font: 700 11px/1.2 Consolas, monospace; letter-spacing: .13em; text-transform: uppercase; }
.eyebrow i { width: 26px; height: 2px; background: var(--accent); display: block; }
h1 { margin: 0; max-width: 640px; font-size: clamp(40px, 5.4vw, 72px); line-height: 1.02; letter-spacing: -.07em; font-weight: 760; }
h1 em { color: var(--accent); font-style: normal; }
.lede { max-width: 530px; margin: 22px 0 0; color: var(--muted); font-size: 17px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); max-width: 570px; margin-top: 42px; border-top: 1px solid var(--line); }
.step { padding: 16px 14px 0 0; }
.step + .step { padding-left: 16px; border-left: 1px solid var(--line); }
.step b { display: block; color: var(--accent); font: 700 11px/1 Consolas, monospace; margin-bottom: 8px; }
.step strong { display: block; font-size: 14px; }
.step span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }

.panel { border: 1px solid rgba(23, 68, 128, .14); border-radius: 18px; background: rgba(255,255,255,.94); box-shadow: var(--shadow); }
.form-panel { padding: 28px; }
.panel h2 { margin: 0; font-size: 21px; letter-spacing: -.04em; }
.panel-copy { margin: 6px 0 20px; color: var(--muted); font-size: 13px; }
.field-label { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 13px; font-weight: 700; }
.field-label small { color: var(--muted); font-weight: 400; }
.secret { position: relative; }
textarea, input[type="text"], select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  outline: none;
}
textarea { min-height: 168px; padding: 14px 58px 14px 14px; resize: vertical; font: 13px/1.65 Consolas, monospace; }
input[type="text"], select { min-height: 42px; padding: 0 12px; }
textarea:focus, input:focus, select:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px rgba(23, 105, 224, .11); }
textarea.masked { -webkit-text-security: disc; }
.ghost {
  position: absolute; top: 10px; right: 10px;
  border: 0; background: transparent; color: var(--muted); font-size: 11px; border-radius: 6px; padding: 4px 6px;
}
.ghost:hover { color: var(--accent); background: var(--pale); }
.meta { display: flex; justify-content: space-between; margin-top: 7px; color: var(--muted); font-size: 11px; }
.actions { display: grid; grid-template-columns: 1fr auto; gap: 9px; margin-top: 18px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 16px; border-radius: 10px; font-size: 13px; font-weight: 700;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn-primary { color: #fff; border: 1px solid var(--accent-dark); background: var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn-primary:disabled { opacity: .65; }
.btn-line { color: var(--ink); border: 1px solid var(--line); background: transparent; }
.btn-line:hover:not(:disabled) { border-color: var(--accent); background: #eef4fc; }
.spin { display: none; width: 13px; height: 13px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.is-loading .spin { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.note { display: flex; gap: 8px; margin: 14px 0 0; color: var(--muted); font-size: 11px; }
.note::before { content: ""; width: 6px; height: 6px; margin-top: 6px; border-radius: 50%; background: var(--accent); flex: none; }
.alert { display: none; margin-top: 12px; padding: 10px 12px; color: var(--danger); background: #f8e5df; border-radius: 8px; font-size: 12px; }
.alert.show { display: block; }

.workspace { margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--line); }
.workspace-head, .mail-head, .lib-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.workspace h2, .lib-title { margin: 0; font-size: 29px; letter-spacing: -.05em; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mini {
  min-height: 34px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--muted); font-size: 11px; font-weight: 700;
}
.mini:hover, .mini.on { color: var(--accent); border-color: var(--accent); background: var(--pale); }
.progress { padding: 22px 24px; margin-top: 16px; }
.task-line { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.ticket { color: var(--muted); font: 11px/1.5 Consolas, monospace; overflow-wrap: anywhere; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: 99px; background: var(--pale); color: var(--accent-dark); font-size: 11px; font-weight: 700; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.running::before { animation: blink 1.1s ease-in-out infinite; }
.pill.done { color: var(--ok); background: #dceee4; }
.pill.failed { color: var(--danger); background: #f8e5df; }
@keyframes blink { 50% { opacity: .25; } }
.track { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin: 20px 0 16px; }
.seg { height: 4px; border-radius: 4px; background: #eef4fc; }
.seg.on { background: var(--accent); }
.seg.ok { background: var(--ok); }
.timeline { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0; padding: 0; list-style: none; }
.timeline li { color: #9aa6b5; font-size: 11px; }
.timeline li strong { display: block; font-size: 12px; }
.timeline li.on { color: var(--ink); font-weight: 700; }
.timeline li.ok { color: var(--ok); }
.reason { display: none; margin: 16px 0 0; padding: 11px 13px; color: var(--danger); background: #f8e5df; border-left: 3px solid var(--danger); font-size: 12px; }
.reason.show { display: block; }

.mailbox { margin-top: 28px; }
.mail-head h3 { margin: 0; font-size: 18px; }
.count { color: var(--muted); font: 11px/1 Consolas, monospace; }
.mail-list { display: grid; gap: 10px; margin-top: 12px; }
.mail-card { border: 1px solid var(--line); border-radius: 13px; background: #fff; overflow: hidden; }
.mail-card[open] { border-color: rgba(23, 105, 224, .38); box-shadow: 0 8px 24px rgba(28, 78, 145, .08); }
.mail-card summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; padding: 16px 40px 16px 16px; cursor: pointer; list-style: none; position: relative; }
.mail-card summary::-webkit-details-marker { display: none; }
.mail-card summary::after { content: ""; position: absolute; top: 22px; right: 18px; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); }
.mail-card[open] summary::after { top: 26px; border-color: var(--accent); transform: rotate(225deg); }
.subject { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.when { color: var(--muted); font: 11px/1.5 Consolas, monospace; }
.mail-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 12px; color: var(--muted); font-size: 11px; align-items: center; }
.box { padding: 1px 6px; border-radius: 4px; background: var(--pale); color: var(--accent-dark); font: 10px/1.6 Consolas, monospace; }
.code {
  border: 0; background: #14233b; color: #fff; border-radius: 999px; padding: 2px 10px; font: 700 12px/1.6 Consolas, monospace;
}
.mail-body { padding: 18px; border-top: 1px solid var(--line); background: #fbfdff; }
.mail-frame { width: 100%; min-height: 240px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.plain { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.8; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 12px; font-size: 13px; }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; }

.notes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); }
.notes div { color: var(--muted); font-size: 12px; }
.notes strong { display: block; margin-bottom: 4px; color: var(--ink); }
footer { padding: 0 0 28px; color: var(--muted); font: 11px/1.5 Consolas, monospace; }

.lib-tools { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0; }
.lib-tools input, .lib-tools select { width: 220px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-size: 11px; font-weight: 700; padding: 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
td:nth-child(2), td:nth-child(3) { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.tag { display: inline-flex; align-items: center; gap: 6px; color: #fff; border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 700; }
.tag i { width: 6px; height: 6px; border-radius: 50%; background: #fff; }
.status { font-size: 11px; font-weight: 700; }
.status.ok { color: var(--ok); }
.status.bad { color: var(--danger); }
.status.wait { color: var(--muted); }
.linkish { border: 0; background: none; color: var(--accent); font-weight: 700; padding: 0 6px; }
.linkish.danger { color: var(--danger); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 4px 0; color: var(--muted); font-size: 12px; }

.modal { border: 0; padding: 0; background: transparent; }
.modal::backdrop { background: rgba(20, 35, 59, .28); }
.modal .panel { width: min(640px, calc(100vw - 32px)); padding: 24px; }
.colors { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.swatch { width: 28px; height: 28px; border-radius: 8px; border: 2px solid transparent; }
.swatch.on { border-color: #14233b; }
.checks { display: grid; gap: 8px; margin-top: 8px; max-height: 240px; overflow: auto; }
.checks label { display: flex; gap: 8px; align-items: center; font-size: 13px; }

@media (max-width: 860px) {
  .shell { width: min(100% - 28px, 680px); }
  .hero, .notes, .steps, .timeline { grid-template-columns: 1fr; }
  .step + .step { border-left: 0; padding-left: 0; }
  .topbar, .workspace-head, .lib-head { align-items: flex-start; flex-direction: column; }
  h1 { font-size: clamp(36px, 12vw, 56px); }
}
