/*
 * DNS Manager: keluarga visual admin_mycomet (sidebar putih, aksen oranye, Segoe UI).
 * Alasan keputusan:
 * - Warna aksen #a84b06 (bukan #c65d09 milik admin_mycomet): teks putih di atas #c65d09 hanya 4.2:1,
 *   #a84b06 memberi 5.7:1 untuk tombol utama. Aksen hanya untuk aksi utama dan menu aktif.
 * - Font sistem Segoe UI: sama dengan admin_mycomet, tanpa unduhan webfont.
 * - Monospace hanya untuk data DNS (nama, nilai, baris zone file) karena sintaks record dibaca per kolom.
 * - Warna status hanya pada badge status nyata (menunggu, aktif, gagal, ditolak).
 * - Tanpa bayangan besar: panel dipisah garis tipis, satu-satunya elevasi ada di tombol utama.
 */

:root {
    --bg: #f7f8fa;
    --surface: #ffffff;
    --surface-2: #f2f4f7;
    --border: #e3e7ec;
    --text: #1f2a3a;
    --muted: #5f6b7d;
    --accent: #a84b06;
    --accent-hover: #8c3e04;
    --accent-text: #a14805;
    --accent-soft: #fff0e4;
    --focus: #e97c29;
    --mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;

    --st-pending-bg: #fff3dc; --st-pending: #7a4a00;
    --st-applied-bg: #e3f5ec; --st-applied: #155c39;
    --st-failed-bg: #fde8e8; --st-failed: #a61b1b;
    --st-applying-bg: #e6effa; --st-applying: #1b5596;
    --st-closed-bg: #eceff3; --st-closed: #465264;
    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #12161c;
    --surface: #1a2028;
    --surface-2: #222a34;
    --border: #2d3640;
    --text: #e6e9ee;
    --muted: #a3adbb;
    --accent: #a84b06;
    --accent-hover: #933f05;
    --accent-text: #f2a46a;
    --accent-soft: #3a2616;
    --st-pending-bg: #3b2c10; --st-pending: #f5c879;
    --st-applied-bg: #13372a; --st-applied: #7fdcae;
    --st-failed-bg: #401b1b; --st-failed: #ffa3a3;
    --st-applying-bg: #172e4a; --st-applying: #9cc7f5;
    --st-closed-bg: #262d36; --st-closed: #b9c2ce;
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Segoe UI", system-ui, -apple-system, sans-serif; font-size: 14px; line-height: 1.5; background: var(--bg); color: var(--text); }
h1, h2, h3, p { margin: 0; }
a { color: var(--accent-text); }
code, .mono { font-family: var(--mono); font-size: 13px; }
a, button, summary, select, label[for], input[type="checkbox"], input[type="radio"], [role="button"] { cursor: pointer; }
button:disabled, input:disabled, select:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--surface); color: var(--text); padding: 10px 14px; border-radius: 8px; border: 1px solid var(--border); }
.skip-link:focus { top: 12px; }
.icon { width: 20px; height: 20px; flex-shrink: 0; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 240px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { display: block; padding: 24px 24px 18px; text-decoration: none; color: var(--text); }
.brand strong { display: block; font-size: 17px; font-weight: 650; letter-spacing: -.3px; }
.brand span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.menu-toggle { display: none; }
.sidebar-menu { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.sidebar nav { padding: 0 12px; flex: 1; }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 12px; margin: 2px 0; border-radius: 9px; color: var(--muted); text-decoration: none; font-size: 14px; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav-count { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 11px; background: var(--st-pending-bg); color: var(--st-pending); font-size: 12px; font-weight: 600; text-align: center; }
.account { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--border); }
.account-initial { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-weight: 600; text-transform: uppercase; flex-shrink: 0; }
.account-name { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-role { display: block; font-size: 12px; color: var(--muted); }
.icon-btn { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); flex-shrink: 0; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { background: var(--border); }

.main { flex: 1; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 36px; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar h1 { font-size: 22px; font-weight: 650; letter-spacing: -.4px; }
.crumb { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--accent-text); }
.theme-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--muted); font: inherit; font-size: 13px; }
.theme-toggle:hover { color: var(--text); background: var(--surface-2); }
[data-theme="dark"] [data-icon-light], :root:not([data-theme="dark"]) [data-icon-dark] { display: none; }
.content { padding: 28px 36px 40px; max-width: 1280px; }

/* ---------- elemen umum ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 9px; border: 1px solid transparent; font: inherit; font-size: 14px; font-weight: 600; text-decoration: none; }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 2px 6px rgb(168 75 6 / .18); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: translateY(1px); box-shadow: none; }
.btn-primary:disabled { opacity: .55; box-shadow: none; }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-secondary:active { background: var(--border); }
.btn-danger { background: var(--surface); border-color: var(--st-failed); color: var(--st-failed); }
.btn-danger:hover { background: var(--st-failed-bg); }
.btn-danger:active { background: var(--st-failed-bg); transform: translateY(1px); }
.btn[aria-busy="true"] { opacity: .7; cursor: progress; }

.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 20px; font-size: 14px; border: 1px solid; }
.alert ul { margin: 0; padding-left: 18px; }
.alert-success { background: var(--st-applied-bg); color: var(--st-applied); border-color: color-mix(in srgb, var(--st-applied) 25%, transparent); }
.alert-error { background: var(--st-failed-bg); color: var(--st-failed); border-color: color-mix(in srgb, var(--st-failed) 25%, transparent); }
.alert-warning { background: var(--st-pending-bg); color: var(--st-pending); border-color: color-mix(in srgb, var(--st-pending) 25%, transparent); }

.badge { display: inline-block; padding: 3px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.st-pending { background: var(--st-pending-bg); color: var(--st-pending); }
.st-applying { background: var(--st-applying-bg); color: var(--st-applying); }
.st-applied { background: var(--st-applied-bg); color: var(--st-applied); }
.st-failed { background: var(--st-failed-bg); color: var(--st-failed); }
.st-rejected, .st-cancelled { background: var(--st-closed-bg); color: var(--st-closed); }
.type { display: inline-block; min-width: 52px; padding: 2px 6px; border: 1px solid var(--border); border-radius: 5px; font-family: var(--mono); font-size: 12px; text-align: center; color: var(--text); }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.panel-pad { padding: 22px 24px; }
.panel h2 { font-size: 16px; font-weight: 650; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.stack > * + * { margin-top: 16px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 10px; }
.tab { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 14px; border-radius: 7px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600; }
.tab:hover { color: var(--text); }
.tab[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / .06); }
.tab span { font-weight: 500; color: var(--muted); }
.search { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

input[type="text"], input[type="search"], input[type="password"], select, textarea {
    min-height: 44px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px;
    background: var(--surface); color: var(--text); font: inherit; font-size: 14px; max-width: 100%;
}
textarea { min-height: 88px; resize: vertical; width: 100%; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--muted) 45%, var(--border)); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--st-failed); }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 13px; color: var(--muted); }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- tabel ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
th { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.row-link { color: var(--text); text-decoration: none; font-weight: 600; }
.row-link:hover { color: var(--accent-text); text-decoration: underline; }
.value { font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }

.empty { padding: 48px 24px; text-align: center; }
.empty h2 { font-size: 16px; margin-bottom: 6px; }
.empty p { color: var(--muted); margin-bottom: 18px; }

.pagination { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.pagination a, .pagination span.page { display: inline-grid; place-items: center; min-width: 40px; min-height: 40px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; color: var(--text); text-decoration: none; }
.pagination a:hover { background: var(--surface-2); }
.pagination [aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; font-weight: 600; }
.pagination .disabled { color: var(--muted); opacity: .5; }

/* ---------- baris record (motif: sintaks zone file yang sebenarnya ditulis) ---------- */
.record-line { display: block; padding: 16px 18px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-family: var(--mono); font-size: 15px; line-height: 1.6; overflow-x: auto; white-space: pre; color: var(--text); }
.record-line .rl-name { color: var(--accent-text); font-weight: 600; }
.record-line .rl-dim { color: var(--muted); }
.record-label { font-size: 12px; color: var(--muted); margin-bottom: 8px; }

/* ---------- detail permintaan ---------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.facts { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px 16px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.note-box { white-space: pre-line; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; font-size: 13px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.timeline li::after { content: ""; position: absolute; left: 7.5px; top: 18px; bottom: 2px; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline li.done::before { background: var(--st-applied); }
.timeline li.bad::before { background: var(--st-failed); }
.timeline strong { display: block; font-size: 13px; }
.decision textarea { margin: 6px 0 12px; }
.decision .btn { width: 100%; }
.decision + .decision { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.error-text { font-family: var(--mono); font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--st-failed); }

/* ---------- form ---------- */
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.field { display: block; }
.field + .field { margin-top: 18px; }
.field > label, .field > .label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field .hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.field .field-error { font-size: 13px; color: var(--st-failed); margin-top: 6px; }
.field select, .field input[type="text"] { width: 100%; }
.name-input { display: flex; align-items: stretch; }
.name-input input { flex: 1; min-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; font-family: var(--mono); }
.name-input .suffix { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--border); border-left: 0; border-radius: 0 9px 9px 0; background: var(--surface-2); color: var(--muted); font-family: var(--mono); font-size: 13px; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.types { display: flex; flex-wrap: wrap; gap: 8px; }
.types label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 9px; font-size: 13px; }
.types label:hover { background: var(--surface-2); }
.types label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.types input { accent-color: var(--accent); width: 16px; height: 16px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.check-result { margin-top: 10px; padding: 10px 12px; border-radius: 8px; font-size: 13px; }
.check-result.ok { background: var(--st-applied-bg); color: var(--st-applied); }
.check-result.bad { background: var(--st-failed-bg); color: var(--st-failed); }
.check-result.unknown, .check-result.loading { background: var(--surface-2); color: var(--muted); }
.side-note h3 { font-size: 14px; font-weight: 650; margin-bottom: 8px; }
.side-note p, .side-note li { font-size: 13px; color: var(--muted); }
.side-note ol { margin: 0; padding-left: 18px; }
.side-note li + li { margin-top: 6px; }

/* ---------- zona ---------- */
.server-block + .server-block { margin-top: 20px; }
.zone-list { list-style: none; margin: 0; padding: 0; }
.zone-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 20px; border-bottom: 1px solid var(--border); }
.zone-list li:last-child { border-bottom: 0; }
.zone-list a.zone-name { font-family: var(--mono); font-size: 14px; color: var(--text); font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.zone-list a.zone-name:hover { color: var(--accent-text); text-decoration: underline; }
.zone-actions { display: flex; align-items: center; gap: 12px; }
.link-add { display: inline-flex; align-items: center; min-height: 44px; font-size: 13px; font-weight: 600; text-decoration: none; }
.link-add:hover { text-decoration: underline; }

/* ---------- login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 400px; padding: 32px 28px; }
.login-card h1 { font-size: 22px; font-weight: 650; letter-spacing: -.3px; }
.login-card .lead { color: var(--muted); margin: 6px 0 24px; font-size: 14px; }
.login-card input { width: 100%; }
.captcha-row { display: flex; gap: 10px; align-items: center; }
.captcha-row img { border-radius: 8px; border: 1px solid var(--border); width: 180px; height: 56px; }
.login-card .btn { width: 100%; margin-top: 22px; }

/* ---------- responsif ---------- */
@media (max-width: 1080px) {
    .detail-grid, .form-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
    .shell { display: block; }
    .sidebar { position: sticky; top: 0; z-index: 20; width: auto; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; border-right: 0; border-bottom: 1px solid var(--border); }
    .brand { padding: 12px 16px; }
    .brand span { display: none; }
    .menu-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-right: 12px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit; font-size: 14px; }
    .sidebar-menu { display: none; width: 100%; border-top: 1px solid var(--border); padding-top: 8px; }
    .sidebar-menu.is-open { display: flex; }
    .topbar { padding: 16px; flex-wrap: wrap; }
    .topbar h1 { font-size: 19px; }
    .content { padding: 20px 16px 32px; }
    .panel-pad { padding: 18px 16px; }
    .facts { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .facts dd { margin-bottom: 10px; }
    .record-line { font-size: 13px; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .search input[type="search"] { flex: 1; min-width: 0; }
    th, td { padding: 10px 12px; }
}

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