:root {
    --bg: #f4f6fb;
    --card: #ffffff;
    --ink: #172033;
    --muted: #6f7a90;
    --line: #e5e9f1;
    --navy: #111827;
    --orange: #f48120;
    --orange-dark: #d9670d;
    --orange-soft: #fff3e8;
    --blue-soft: #eef5ff;
    --green: #16a36a;
    --red: #db4b4b;
    --yellow: #d99416;
    --shadow: 0 10px 35px rgba(26, 38, 65, .07);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); font-size: 14px; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.app-shell { min-width: 0; min-height: 100vh; display: grid; grid-template-columns: 246px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 26px 18px; background: var(--navy); color: #fff; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 30px; }
.brand-mark { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-weight: 800; letter-spacing: -.5px; color: #fff; background: linear-gradient(135deg, #f7a83b, #f16a16); box-shadow: 0 7px 20px rgba(244, 129, 32, .3); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; }
.brand small { margin-top: 3px; color: #8e99ad; font-size: 11px; letter-spacing: .7px; }
.sidebar nav { display: grid; gap: 8px; }
.nav-item { border: 0; border-radius: 12px; padding: 13px 14px; color: #9ca7ba; background: transparent; display: flex; align-items: center; gap: 11px; text-align: left; transition: .18s ease; }
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.active { color: #fff; background: rgba(244,129,32,.14); box-shadow: inset 3px 0 var(--orange); }
.nav-icon { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 7px; background: rgba(255,255,255,.07); font-size: 18px; }
.nav-item.active .nav-icon { background: var(--orange); }
.privacy-note { margin-top: auto; padding: 15px 14px; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; background: rgba(255,255,255,.035); display: grid; grid-template-columns: 9px 1fr; gap: 10px; }
.privacy-note strong, .privacy-note small { display: block; }
.privacy-note strong { font-size: 12px; color: #dce3ef; }
.privacy-note small { margin-top: 5px; font-size: 10px; line-height: 1.55; color: #7f8ba0; }
.status-dot { width: 8px; height: 8px; margin-top: 4px; border-radius: 50%; background: #2fc487; box-shadow: 0 0 0 4px rgba(47,196,135,.1); }

.main-content { min-width: 0; width: min(1180px, calc(100% - 56px)); margin: 0 auto; padding: 40px 0 26px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; margin-bottom: 25px; }
.topbar h1 { margin: 4px 0 8px; font-size: clamp(25px, 3vw, 34px); letter-spacing: -.8px; }
.topbar p { margin: 0; color: var(--muted); }
.eyebrow { color: var(--orange) !important; font-size: 11px; font-weight: 800; letter-spacing: 1.6px; }
.topbar-badge { flex: none; margin-top: 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.7); color: #69748a; font-size: 12px; }
.topbar-badge span { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--green); }

.card { min-width: 0; margin-bottom: 18px; padding: 24px; background: var(--card); border: 1px solid rgba(225,230,240,.9); border-radius: 17px; box-shadow: var(--shadow); }
.card-heading { margin-bottom: 22px; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.card-heading > div:first-child { display: flex; align-items: flex-start; gap: 13px; }
.card-heading h2 { margin: 0 0 5px; font-size: 16px; }
.card-heading p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.card-heading.compact { margin-bottom: 17px; align-items: center; }
.step-badge { flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: var(--orange-dark); background: var(--orange-soft); font-size: 11px; font-weight: 800; }
.step-badge.success { color: var(--green); background: #e8f8f1; font-size: 15px; }
.text-button { border: 0; padding: 3px; color: var(--orange-dark); background: transparent; font-size: 12px; }

.account-grid { display: grid; grid-template-columns: 1.25fr 1.25fr 1fr 1fr; gap: 14px; }
.span-2 { grid-column: span 2; }
.auth-switch { margin-bottom: 16px; display: flex; flex-wrap: wrap; gap: 9px; }
.auth-choice { position: relative; min-width: 210px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 11px; background: #fafbfc; cursor: pointer; }
.auth-choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.auth-choice span, .auth-choice small { display: block; }
.auth-choice span { color: #4b566c; font-size: 12px; font-weight: 750; }
.auth-choice small { margin-top: 4px; color: #939bad; font-size: 10px; }
.auth-choice.active { border-color: var(--orange); background: var(--orange-soft); box-shadow: 0 0 0 3px rgba(244,129,32,.07); }
.auth-choice.active span { color: var(--orange-dark); }
.account-fields { display: grid; grid-template-columns: 1fr 1.25fr .9fr; gap: 14px; }
.account-fields[hidden] { display: none; }
.token-fields { grid-template-columns: 1.5fr 1fr; }
.account-footer { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.account-footer > div:first-child { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.clear-credentials { color: #8b94a6; }
.account-verify { display: flex; align-items: center; gap: 12px; }
.account-verify small { max-width: 280px; text-align: right; }
.account-warning { margin-top: 15px; }
.account-warning[hidden] { display: none; }
.field { display: grid; gap: 7px; }
.field > span, .action-field > span { color: #465066; font-size: 12px; font-weight: 700; }
.field small { color: #8a94a7; font-size: 10px; line-height: 1.45; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fbfcfe; outline: none; transition: border .15s, box-shadow .15s, background .15s; }
input, select { height: 42px; padding: 0 12px; }
textarea { min-height: 120px; padding: 13px 14px; line-height: 1.75; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: rgba(244,129,32,.75); box-shadow: 0 0 0 3px rgba(244,129,32,.1); background: #fff; }
input::placeholder, textarea::placeholder { color: #afb6c4; }
.action-field { display: grid; grid-template-columns: 1fr; align-content: start; gap: 7px; }
.muted { color: #949cad !important; }
.status-ok { color: var(--green) !important; }
.status-bad { color: var(--red) !important; }
.check-line { margin-top: 15px; display: flex; align-items: center; gap: 9px; color: #69748a; font-size: 11px; }
.check-line.spaced { margin-top: 17px; }
.check-line.no-margin { margin-top: 0; }
.check-line input { width: 15px; height: 15px; accent-color: var(--orange); }

.button { min-height: 42px; border: 0; border-radius: 10px; padding: 0 18px; font-weight: 750; transition: transform .15s, opacity .15s, background .15s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; transform: none; opacity: .55; }
.button.primary { color: #fff; background: linear-gradient(135deg, #f5912f, #ef7317); box-shadow: 0 8px 18px rgba(239,115,23,.25); }
.button.secondary { color: #344055; background: #eff2f7; }
.button.ghost { min-height: 36px; border: 1px solid var(--line); color: #4e596e; background: #fff; }
.button.small { padding: 0 12px; font-size: 11px; }
.counter { padding: 7px 10px; border-radius: 8px; color: #778196; background: #f4f6fa; font-size: 11px; }
.counter strong { color: var(--orange-dark); font-size: 14px; }
.inline-options { margin-top: 17px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.switch-line { display: inline-flex; align-items: center; gap: 11px; cursor: pointer; }
.switch-line > input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { width: 36px; height: 21px; padding: 2px; border-radius: 999px; background: #cbd1dc; transition: .18s; }
.switch::after { content: ""; display: block; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.18); transition: .18s; }
.switch-line input:checked + .switch { background: var(--orange); }
.switch-line input:checked + .switch::after { transform: translateX(15px); }
.switch-line strong, .switch-line small { display: block; }
.switch-line strong { color: #39445a; font-size: 12px; }
.switch-line small { margin-top: 3px; color: #8f98aa; font-size: 10px; }
.select-line { display: flex; align-items: center; gap: 8px; color: #7b8496; font-size: 11px; }
.select-line select { width: auto; min-width: 132px; height: 36px; }
.dns-template-card.disabled { opacity: .48; pointer-events: none; }

.workspace-panel { min-width: 0; }
.record-table-wrap, .result-table-wrap { max-width: 100%; overflow-x: auto; }
.record-table, .result-table { width: 100%; border-collapse: collapse; }
.record-table th, .result-table th { padding: 8px 7px 10px; color: #8a93a5; font-size: 10px; font-weight: 750; text-align: left; white-space: nowrap; }
.record-table td { padding: 5px 6px; border-top: 1px solid #f0f2f6; }
.record-table th:nth-child(1) { width: 105px; }
.record-table th:nth-child(2) { width: 155px; }
.record-table th:nth-child(4) { width: 125px; }
.record-table th:nth-child(5), .record-table th:nth-child(6) { width: 60px; text-align: center; }
.record-table td:nth-child(5), .record-table td:nth-child(6) { text-align: center; }
.record-table input, .record-table select { height: 38px; border-radius: 8px; font-size: 12px; }
.mini-switch { position: relative; display: inline-block; }
.mini-switch input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; }
.mini-switch span { display: inline-block; width: 31px; height: 18px; padding: 2px; border-radius: 999px; background: #ccd2dd; vertical-align: middle; }
.mini-switch span::after { content: ""; display: block; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: .15s; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.mini-switch input:checked + span { background: var(--orange); }
.mini-switch input:checked + span::after { transform: translateX(13px); }
.mini-switch input:disabled + span { opacity: .35; }
.icon-button { width: 30px; height: 30px; border: 0; border-radius: 8px; color: #9ba3b1; background: transparent; font-size: 20px; }
.icon-button:hover { color: var(--red); background: #fff0f0; }
.template-actions { margin-top: 15px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid #e3e7ef; border-radius: 999px; padding: 7px 11px; color: #697387; background: #f8f9fb; font-size: 10px; }
.chip:hover { border-color: #f0b98a; color: var(--orange-dark); background: var(--orange-soft); }
.conflict-select { margin-left: auto; }

.action-card { margin: 18px 0; padding: 19px 23px; border-radius: 15px; color: #fff; background: linear-gradient(120deg, #222b3d, #151b28); display: flex; align-items: center; justify-content: space-between; gap: 20px; box-shadow: 0 12px 30px rgba(18,25,38,.17); }
.action-card strong, .action-card span { display: block; }
.action-card strong { margin-bottom: 5px; font-size: 14px; }
.action-card span { color: #98a3b6; font-size: 11px; }
.workspace-panel[hidden] { display: none; }

.lookup-all-switch { margin-bottom: 17px; }
.lookup-domain-field { margin-bottom: 17px; transition: opacity .18s ease; }
.lookup-domain-field.disabled-field { opacity: .5; }
.lookup-options { margin: 17px 0; display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 20px; align-items: end; }
.lookup-option-group { min-height: 72px; display: flex; align-items: center; flex-wrap: wrap; gap: 12px 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfe; }
.lookup-option-group > span { width: 100%; color: #465066; font-size: 12px; font-weight: 700; }
.lookup-host-filter { align-self: stretch; align-content: end; }
.lookup-result-heading { align-items: center; }
.lookup-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.lookup-table td:nth-child(1), .lookup-table td:nth-child(2) { white-space: nowrap; }
.lookup-value { display: grid; gap: 4px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.lookup-value small { color: #718097; font: 10px/1.45 Inter, ui-sans-serif, system-ui, sans-serif; }
.missing-value { color: #ad4d4d; font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-weight: 700; }
.lookup-source { display: grid; gap: 5px; min-width: 150px; }
.lookup-source small { color: #7f899b; font-size: 10px; line-height: 1.45; }
.source-ok { color: #667187; font-size: 10px; }
.record-type-pill, .proxy-pill { display: inline-block; padding: 4px 7px; border-radius: 7px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.record-type-pill { color: #4d5a72; background: #edf1f7; }
.proxy-pill.proxied { color: #a6510d; background: #fff0df; }
.proxy-pill.dns-only { color: #39705d; background: #e9f7f1; }
.empty-cell { padding: 30px 12px !important; color: #8d96a7 !important; text-align: center; }
.lookup-errors { margin-top: 15px; padding: 13px 15px; border-radius: 10px; color: #9f3434; background: #fff0f0; font-size: 11px; line-height: 1.6; }
.lookup-errors strong, .lookup-errors span { display: block; }
.lookup-errors strong { margin-bottom: 5px; }

.cert-options { justify-content: flex-start; gap: 28px; }
.method-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.method-card { position: relative; min-height: 92px; padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: #fbfcfe; display: flex; align-items: flex-start; gap: 12px; cursor: pointer; transition: .18s ease; }
.method-card:hover { border-color: #efc29c; }
.method-card.active { border-color: var(--orange); background: var(--orange-soft); box-shadow: 0 0 0 3px rgba(244,129,32,.08); }
.method-card > input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.method-radio { flex: none; width: 17px; height: 17px; margin-top: 2px; border: 2px solid #c2c9d5; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 3px #fff; }
.method-card.active .method-radio { border-color: var(--orange); background: var(--orange); }
.method-card strong, .method-card small { display: block; }
.method-card strong { color: #334057; font-size: 13px; }
.method-card small { margin-top: 7px; color: #818b9e; font-size: 10px; line-height: 1.55; }
.method-settings { margin-top: 17px; padding: 17px; border: 1px solid #edf0f5; border-radius: 12px; background: #fafbfc; display: grid; grid-template-columns: 180px 180px minmax(0, 1fr); align-items: end; gap: 15px; }
.method-settings[hidden] { display: none; }
.bt-site-field { grid-column: span 2; }
.deploy-note { grid-column: 1 / -1; align-self: stretch; }
.notice { padding: 13px 15px; border-radius: 10px; color: #59657b; background: var(--blue-soft); font-size: 11px; line-height: 1.6; }
.notice strong, .notice span { display: block; }
.notice strong { margin-bottom: 3px; color: #354158; font-size: 11px; }
.notice.warning { color: #87600e; background: #fff7df; }
.notice.warning strong { color: #815405; }
.notice.success { color: #187251; background: #e9f8f1; }
.notice.success strong { color: #0d6544; }
.certificate-output { margin-top: 18px; }
.command-box { max-height: 390px; margin: 14px 0; padding: 17px; border-radius: 11px; overflow: auto; color: #dfe7f3; background: #111827; white-space: pre-wrap; overflow-wrap: anywhere; font: 11px/1.65 ui-monospace, SFMono-Regular, Consolas, monospace; }
.download-actions { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 10px; }
.danger-text { margin: 12px 0 0; color: #b34c4c; font-size: 10px; }

.results-card { margin-top: 24px; }
.progress-track { height: 7px; border-radius: 999px; background: #eef0f4; overflow: hidden; }
.progress-track div { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--orange), #ffb347); transition: width .3s ease; }
.result-stats { margin: 15px 0 8px; display: flex; flex-wrap: wrap; gap: 19px; color: #778196; font-size: 11px; }
.result-stats strong { color: #3a465d; }
.stat-dot { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; }
.stat-dot.waiting { background: #a6afbf; }.stat-dot.ok { background: var(--green); }.stat-dot.warn { background: var(--yellow); }.stat-dot.bad { background: var(--red); }
.result-table th { padding-top: 12px; border-bottom: 1px solid var(--line); }
.result-table td { padding: 12px 7px; border-bottom: 1px solid #f0f2f6; color: #4d586d; font-size: 11px; vertical-align: top; }
.result-table td:first-child { font-weight: 750; color: #2d384d; }
.result-table td:last-child { max-width: 380px; color: #7b8495; line-height: 1.5; }
.status-pill { display: inline-block; border-radius: 999px; padding: 5px 8px; font-size: 10px; font-weight: 800; }
.status-pill.running { color: #536079; background: #edf0f5; }
.status-pill.ok { color: #08764a; background: #e4f7ef; }
.status-pill.partial { color: #9b6708; background: #fff4d9; }
.status-pill.failed { color: #b32929; background: #ffebeb; }

.toast-stack { position: fixed; z-index: 50; right: 22px; bottom: 22px; display: grid; gap: 9px; }
.toast { min-width: 280px; max-width: 400px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 11px; color: #3e495f; background: #fff; box-shadow: 0 15px 45px rgba(20,28,44,.17); animation: toast-in .22s ease; }
.toast.error { border-color: #ffd3d3; color: #a83333; background: #fffafa; }
.toast.success { border-color: #ccefe0; color: #14744e; background: #f7fffb; }
@keyframes toast-in { from { opacity: 0; transform: translateY(9px); } }
footer { padding: 15px 0 0; text-align: center; color: #a1a9b7; font-size: 10px; }

@media (max-width: 900px) {
    .app-shell { grid-template-columns: minmax(0, 1fr); }
    .sidebar { position: static; width: 100%; height: auto; padding: 15px 18px; flex-direction: row; align-items: center; gap: 16px; overflow-x: auto; }
    .brand { padding: 0; min-width: max-content; }
    .brand-mark { width: 36px; height: 36px; border-radius: 10px; }
    .sidebar nav { display: flex; min-width: max-content; }
    .nav-item { padding: 10px 12px; }
    .privacy-note { display: none; }
    .main-content { width: min(100% - 28px, 1180px); padding-top: 26px; }
    .account-grid { grid-template-columns: 1fr 1fr; }
    .account-fields { grid-template-columns: 1fr 1fr; }
    .account-fields .field:last-child { grid-column: span 2; }
    .token-fields .field:last-child { grid-column: auto; }
    .span-2 { grid-column: span 2; }
    .lookup-options { grid-template-columns: minmax(0, 1fr) 190px; }
}

@media (max-width: 620px) {
    .brand small, .nav-icon { display: none; }
    .topbar { display: block; }
    .topbar-badge { display: inline-block; }
    .card { padding: 18px 15px; border-radius: 14px; }
    .account-grid { grid-template-columns: 1fr; }
    .account-fields, .token-fields { grid-template-columns: 1fr; }
    .account-fields .field:last-child, .token-fields .field:last-child { grid-column: auto; }
    .auth-choice { width: 100%; }
    .account-footer, .account-verify { align-items: stretch; flex-direction: column; }
    .account-verify small { max-width: none; text-align: left; }
    .account-verify .button { width: 100%; }
    .span-2 { grid-column: span 1; }
    .inline-options, .action-card { align-items: stretch; flex-direction: column; }
    .cert-options { gap: 12px; }
    .select-line { justify-content: space-between; }
    .action-card .button { width: 100%; }
    .card-heading { gap: 10px; }
    .card-heading.compact { align-items: flex-start; }
    .record-table { min-width: 720px; }
    .result-table { min-width: 700px; }
    .conflict-select { width: 100%; margin-left: 0; }
    .method-grid { grid-template-columns: 1fr; }
    .method-settings { grid-template-columns: 1fr; }
    .bt-site-field, .deploy-note { grid-column: auto; }
    .lookup-options { grid-template-columns: 1fr; }
    .lookup-result-heading { align-items: flex-start; flex-direction: column; }
    .lookup-actions { width: 100%; }
    .lookup-actions .button { flex: 1; }
    .lookup-table { min-width: 940px; }
}
