/* AppleID panel — 9527-style dark layout (UI only) */
:root {
  --bg: #0b0d12;
  --bg2: #12151c;
  --bg3: #1a1d27;
  --line: #2a2f3d;
  --text: #e5e7eb;
  --muted: #93a0b4;
  --dim: #6b7280;
  --accent: #3b82f6;
  --accent-soft: #1e3a5f;
  --ok: #6ee7b7;
  --warn: #fcd34d;
  --bad: #fca5a5;
  --run: #93c5fd;
  --btn: #2563eb;
  --btn-hover: #1d4ed8;
  --danger: #dc2626;
  --radius: 10px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5; min-height: 100%; }
a { color: #93c5fd; text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

.top-sticky {
  position: sticky; top: 0; z-index: 100;
  background: linear-gradient(180deg, #12151c 0%, #0f1219 100%);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.top-bar {
  max-width: 1180px; margin: 0 auto;
  padding: 12px 18px 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: .02em; color: #f8fafc; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: #1e293b; color: var(--muted); border: 1px solid var(--line);
}
.badge.warn { background: #422006; color: var(--warn); border-color: #854d0e; }
.badge.ok { background: #052e1a; color: var(--ok); border-color: #166534; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.btn, button {
  appearance: none; border: 1px solid var(--line); background: var(--bg3); color: var(--text);
  border-radius: 8px; padding: 7px 12px; font-size: 13px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover, button:hover { background: #232837; border-color: #3b4254; }
.btn-primary, button:not(.ghost):not(.danger):not(.linkish):not(.vbtn) {
  background: var(--btn); border-color: #1d4ed8; color: #fff;
}
.btn-primary:hover, button:not(.ghost):not(.danger):not(.linkish):not(.vbtn):hover { background: var(--btn-hover); }
button.ghost, .btn-ghost { background: transparent; color: var(--muted); }
button.danger { background: #7f1d1d; border-color: #991b1b; color: #fecaca; }
button.danger:hover { background: #991b1b; }
.linkish { background: none; border: none; color: #93c5fd; padding: 2px 6px; font-size: 12px; }
.danger-text { color: #fca5a5 !important; }

.stats {
  max-width: 1180px; margin: 0 auto;
  padding: 0 18px 12px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px;
}
.stat {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; min-width: 0;
}
.stat .num { font-size: 20px; font-weight: 700; color: #fbbf24; font-variant-numeric: tabular-nums; }
.stat .label { font-size: 11px; color: var(--dim); margin-top: 2px; }

.main-tabs {
  max-width: 1180px; margin: 0 auto;
  padding: 0 18px;
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}
.main-tab {
  padding: 10px 14px; cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px; user-select: none;
}
.main-tab:hover { color: var(--text); }
.main-tab.active { color: #93c5fd; border-bottom-color: #3b82f6; }

.container { max-width: 1180px; margin: 0 auto; padding: 16px 18px 40px; }
.tab-panel { display: none; animation: fade .18s ease; }
.tab-panel.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.sub-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.sub-tab {
  padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg2); color: var(--muted); font-size: 12px; cursor: pointer; font-weight: 600;
}
.sub-tab.active { background: var(--accent-soft); border-color: #2563eb; color: #93c5fd; }
.sub-view { display: none; }
.sub-view.active { display: block; }

.card {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 18px; margin-bottom: 14px;
}
.card h2 { margin: 0 0 8px; font-size: 16px; font-weight: 700; color: #f3f4f6; }
.hint { color: var(--muted); font-size: 12px; margin: 0 0 12px; line-height: 1.55; }
.muted { color: var(--dim); font-size: 12px; }
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.panel-head h2 { margin: 0; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
@media (max-width: 720px) { .grid { grid-template-columns: 1fr; } }
.grid .full { grid-column: 1 / -1; }
label { display: block; font-size: 12px; color: var(--muted); }
label > input, label > select, label > textarea,
input, select, textarea {
  width: 100%; margin-top: 5px;
  background: #0f1117; border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 8px 10px; font-size: 13px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,.15); }
label.check { display: flex; align-items: center; gap: 8px; margin-top: 6px; color: var(--text); font-size: 13px; }
label.check input { width: auto; margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.actions.full-actions { grid-column: 1 / -1; }

.parse-box {
  background: #0f1117; border: 1px dashed #334155; border-radius: 10px;
  padding: 12px 14px; margin-bottom: 14px;
}
.msg { margin-top: 8px; font-size: 13px; min-height: 1.2em; }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--bad); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #1a1d27; color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(59,130,246,.04); }
.ops { display: flex; gap: 6px; flex-wrap: wrap; white-space: nowrap; }
.ops button { padding: 5px 9px; font-size: 12px; }
.msgcell { max-width: 280px; word-break: break-word; color: var(--muted); font-size: 12px; }

.st { display: inline-flex; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; border: 1px solid transparent; }
.st-ok { background: #052e1a; color: var(--ok); border-color: #166534; }
.st-fail { background: #450a0a; color: var(--bad); border-color: #7f1d1d; }
.st-wait { background: #1f2937; color: #9ca3af; border-color: #374151; }
.st-running { background: #0c4a6e; color: var(--run); border-color: #0369a1; }

.checks { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto;
  padding: 10px; background: #0f1117; border: 1px solid var(--line); border-radius: 8px; margin-top: 6px; }

.share-toolbar { margin: 12px 0; padding: 10px 12px; background: #0f1117; border-radius: 8px; border: 1px solid var(--line); }
.share-tpl { display: block; margin-top: 6px; word-break: break-all; color: #fcd34d; }
.share-board { display: flex; flex-direction: column; gap: 16px; margin-top: 12px; }
.share-block { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #0f1117; }
.share-block-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; background: var(--bg3); border-bottom: 1px solid var(--line);
}
.share-block-title { display: flex; align-items: center; gap: 8px; }
.pill { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: #422006; color: var(--warn); border: 1px solid #854d0e; }
.share-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; padding: 14px; }
.vcard {
  position: relative; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
}
.vcard-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: #64748b; }
.vcard-bar.ok { background: #22c55e; }
.vcard-bar.bad { background: #ef4444; }
.vcard-bar.run { background: #3b82f6; }
.vcard-bar.wait { background: #94a3b8; }
.vcard-body { padding: 14px 14px 14px 16px; }
.vcard-h { font-size: 12px; color: var(--dim); margin-bottom: 4px; }
.vcard-email { font-weight: 700; word-break: break-all; margin-bottom: 6px; }
.vcard-m { font-size: 12px; color: var(--muted); margin: 4px 0; }
.vcard-btns { display: flex; gap: 8px; margin-top: 10px; }
.vbtn { flex: 1; border: none; border-radius: 8px; padding: 8px; font-size: 12px; font-weight: 600; cursor: pointer; color: #fff; }
.vbtn.blue { background: #2563eb; }
.vbtn.green { background: #059669; }
.vbadge { font-size: 11px; padding: 1px 7px; border-radius: 999px; }
.vbadge.ok { background: #052e1a; color: var(--ok); }
.vbadge.bad { background: #450a0a; color: var(--bad); }
.vbadge.run { background: #0c4a6e; color: var(--run); }
.vbadge.wait { background: #1f2937; color: #9ca3af; }
.vcard-empty, .share-empty { color: var(--dim); padding: 12px; }

.api-box label { margin-top: 10px; display: block; }
.api-box code { background: #0f1117; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line); word-break: break-all; }
pre.code {
  margin-top: 14px; padding: 12px 14px; background: #0f1117; border: 1px solid var(--line);
  border-radius: 10px; overflow-x: auto; color: #cbd5e1; font-size: 12px; line-height: 1.6;
}

.logs { list-style: none; margin: 0; padding: 0; max-height: 480px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.logs li {
  padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted);
  display: grid; grid-template-columns: 140px 160px 1fr; gap: 8px;
}
.logs li:last-child { border-bottom: none; }
.logs li .t { color: var(--dim); font-variant-numeric: tabular-nums; }
.logs li .id { color: #fbbf24; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logs li.warn { color: var(--warn); }
.logs li.error { color: var(--bad); }
.logs li.info { color: var(--muted); }
@media (max-width: 720px) {
  .logs li { grid-template-columns: 1fr; gap: 2px; }
}

/* login page */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(59,130,246,.18), transparent),
    var(--bg);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px; background: var(--bg2); border: 1px solid var(--line);
  border-radius: 14px; padding: 28px 24px; box-shadow: 0 20px 50px rgba(0,0,0,.35);
}
.login-card h1 { margin: 0 0 6px; font-size: 20px; text-align: center; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 12px; margin-bottom: 20px; }
.login-card label { margin-bottom: 12px; }
.login-card button { width: 100%; margin-top: 8px; padding: 10px; font-weight: 600; }
.login-err { color: var(--bad); font-size: 13px; text-align: center; margin-top: 10px; min-height: 1.2em; }

.edit-banner {
  margin-bottom: 14px; padding: 10px 12px; border-radius: 8px;
  background: #422006; border: 1px solid #854d0e; color: #fcd34d; font-size: 13px;
}
.pill.soft { background: #1e3a5f; color: #93c5fd; border-color: #1d4ed8; }
.share-path { margin-left: 6px; color: #fbbf24; font-size: 12px; }


/* account health LED (top) */
.health-led {
  display: inline-flex; align-items: center; gap: 10px;
  margin-left: 6px;
  padding: 6px 12px 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg2);
  min-width: 132px;
}
.health-led .led {
  width: 14px; height: 14px; border-radius: 50%;
  background: #6b7280;
  box-shadow: 0 0 0 3px rgba(107,114,128,.2);
  flex-shrink: 0;
}
.health-led .health-meta { line-height: 1.2; }
.health-led .health-title { font-size: 12px; font-weight: 700; color: var(--text); }
.health-led .health-sub { font-size: 10px; color: var(--dim); margin-top: 1px; }
.health-led.health-ok { border-color: #166534; background: #052e1a; }
.health-led.health-ok .led {
  background: #22c55e;
  box-shadow: 0 0 10px rgba(34,197,94,.75), 0 0 0 3px rgba(34,197,94,.2);
  animation: ledPulseOk 2s ease-in-out infinite;
}
.health-led.health-ok .health-title { color: var(--ok); }
.health-led.health-warn { border-color: #854d0e; background: #422006; }
.health-led.health-warn .led {
  background: #f59e0b;
  box-shadow: 0 0 10px rgba(245,158,11,.7), 0 0 0 3px rgba(245,158,11,.2);
  animation: ledPulseWarn 1.6s ease-in-out infinite;
}
.health-led.health-warn .health-title { color: var(--warn); }
.health-led.health-bad { border-color: #991b1b; background: #450a0a; }
.health-led.health-bad .led {
  background: #ef4444;
  box-shadow: 0 0 12px rgba(239,68,68,.8), 0 0 0 3px rgba(239,68,68,.25);
  animation: ledPulseBad 1.1s ease-in-out infinite;
}
.health-led.health-bad .health-title { color: var(--bad); }
.health-led.health-wait .led { background: #6b7280; }
@keyframes ledPulseOk {
  0%, 100% { box-shadow: 0 0 8px rgba(34,197,94,.55), 0 0 0 3px rgba(34,197,94,.15); }
  50% { box-shadow: 0 0 14px rgba(34,197,94,.9), 0 0 0 4px rgba(34,197,94,.25); }
}
@keyframes ledPulseWarn {
  0%, 100% { box-shadow: 0 0 8px rgba(245,158,11,.5), 0 0 0 3px rgba(245,158,11,.15); }
  50% { box-shadow: 0 0 14px rgba(245,158,11,.85), 0 0 0 4px rgba(245,158,11,.25); }
}
@keyframes ledPulseBad {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px rgba(239,68,68,.55), 0 0 0 3px rgba(239,68,68,.2); }
  50% { opacity: .85; box-shadow: 0 0 16px rgba(239,68,68,.95), 0 0 0 4px rgba(239,68,68,.3); }
}
td[data-field="last_check"] { white-space: nowrap; font-size: 12px; }


/* Main-tab status lights (above label) */
.main-tabs { align-items: flex-end; }
.main-tab {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  min-width: 64px;
  text-align: center;
  padding: 8px 12px 10px;
}
.main-tab .tab-txt { line-height: 1.2; }
.main-tab .tab-led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #6b7280;
  box-shadow: 0 0 0 2px rgba(107,114,128,.25);
  flex-shrink: 0;
}
.main-tab .tab-led[data-level="ok"] {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34,197,94,.75), 0 0 0 2px rgba(34,197,94,.25);
}
.main-tab .tab-led[data-level="warn"] {
  background: #f59e0b;
  box-shadow: 0 0 8px rgba(245,158,11,.7), 0 0 0 2px rgba(245,158,11,.25);
}
.main-tab .tab-led[data-level="bad"] {
  background: #ef4444;
  box-shadow: 0 0 10px rgba(239,68,68,.85), 0 0 0 2px rgba(239,68,68,.3);
  animation: tabLedBlink 1.1s ease-in-out infinite;
}
.main-tab .tab-led[data-level="run"] {
  background: #38bdf8;
  box-shadow: 0 0 8px rgba(56,189,248,.7), 0 0 0 2px rgba(56,189,248,.25);
}
.main-tab .tab-led[data-level="wait"] {
  background: #6b7280;
  box-shadow: 0 0 0 2px rgba(107,114,128,.25);
}
@keyframes tabLedBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}
/* hide legacy brand health pill if residual */
.health-led { display: none !important; }

/* click-to-copy fields */
.copyable {
  cursor: pointer;
  border-bottom: 1px dashed rgba(255,255,255,0.25);
}
.copyable:hover {
  color: #8ec8ff;
  border-bottom-color: #8ec8ff;
}
.copyable.copied {
  color: #7ddea0;
}

td.vault-pw, td[data-vfield="password"], td[data-field="password"] {
  color: #e8f0ff;
  font-weight: 600;
  letter-spacing: 0.02em;
  user-select: all;
}

/* copyable + toast feedback */
.copyable,
[data-copy-text].copyable,
td[data-copy-text],
span.copyable {
  cursor: pointer !important;
  position: relative;
  border-bottom: 1px dashed rgba(140, 190, 255, 0.45);
  transition: background 0.15s, color 0.15s;
}
.copyable:hover,
td[data-copy-text]:hover {
  color: #9ed0ff;
  background: rgba(80, 140, 220, 0.12);
}
.copied-flash {
  background: rgba(60, 180, 100, 0.28) !important;
  color: #b8f0c8 !important;
  outline: 1px solid rgba(100, 220, 140, 0.5);
}
.copy-badge {
  position: absolute;
  top: -10px;
  right: 0;
  z-index: 5;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 4px;
  background: #2d8a4e;
  color: #fff;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}
#copyToast.copy-toast,
.copy-toast {
  position: fixed;
  left: 50%;
  top: 18%;
  transform: translateX(-50%) translateY(-8px);
  z-index: 99999;
  min-width: 200px;
  max-width: min(90vw, 420px);
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  box-shadow: 0 8px 28px rgba(0,0,0,0.45);
}
.copy-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.copy-toast.ok {
  background: #1f7a45;
  border: 1px solid #3bb86a;
}
.copy-toast.err {
  background: #8a2e2e;
  border: 1px solid #d06060;
}
td.vault-pw b { font-weight: 700; user-select: all; }

/* vault human wait prompt */
.vault-wait-active {
  border: 1px solid #f59e0b !important;
  background: #fff7ed !important;
  padding: 12px 14px !important;
  border-radius: 8px;
}
.vault-wait-active b {
  color: #c2410c;
  font-size: 15px;
}

/* vault wait input - always visible when needed */
.vault-wait-row td {
  background: #fff7ed !important;
  border-top: none !important;
  padding: 10px 12px 14px !important;
}
.vault-inline-wait b.vault-wait-label {
  color: #c2410c;
  font-size: 14px;
  display: block;
  margin-bottom: 4px;
}
.vault-global-wait input,
.vault-inline-wait input {
  padding: 8px 10px;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  font-size: 15px;
}
.vault-wait-active {
  border: 1px solid #f59e0b !important;
  background: #fff7ed !important;
  padding: 12px 14px !important;
  border-radius: 8px;
}
.vault-wait-active b { color: #c2410c; font-size: 15px; }
