* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: #eef2f6; color: #263244; }
button, input, textarea, select { font: inherit; }
button { border: 0; background: #f38020; color: #fff; border-radius: 8px; padding: 12px 16px; font-weight: 700; cursor: pointer; }
button:hover { background: #e67610; }
button:disabled { background: #c7cbd1; cursor: not-allowed; }
.secondary-btn { background: #667085; }
.secondary-btn:hover { background: #586273; }
input, textarea, select { width: 100%; border: 1px solid #d9dee7; border-radius: 8px; padding: 12px; background: #fff; color: #263244; }
textarea { resize: vertical; font-family: Consolas, monospace; line-height: 1.55; }
label { display: block; margin: 14px 0 7px; font-weight: 700; font-size: 14px; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(460px, 100%); background: #fff; border-radius: 14px; padding: 30px; box-shadow: 0 10px 32px rgba(15,23,42,0.1); border: 1px solid #e5e7eb; }
.auth-card h1 { margin: 0 0 10px; color: #f38020; }
.auth-card p { margin: 0 0 22px; color: #667085; line-height: 1.7; }
.auth-card button { width: 100%; margin-top: 16px; }
.auth-log { margin-top: 14px; color: #d93025; font-size: 14px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 240px 1fr; }
.sidebar { background: #152033; color: #d9e1ef; padding: 22px; display: flex; flex-direction: column; gap: 18px; }
.brand strong { display: block; color: #fff; font-size: 20px; }
.brand span { display: block; margin-top: 4px; color: #95a3b8; font-size: 13px; }
nav { display: grid; gap: 8px; }
.nav-btn, .logout { width: 100%; text-align: left; background: transparent; color: #d9e1ef; padding: 11px 12px; border-radius: 8px; }
.nav-btn:hover, .nav-btn.active { background: rgba(243,128,32,0.18); color: #fff; }
.logout { margin-top: auto; background: rgba(255,255,255,0.08); }

.workspace { padding: 24px; overflow: auto; }
.topbar { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 22px 24px; display: flex; align-items: center; justify-content: space-between; gap: 18px; box-shadow: 0 4px 18px rgba(15,23,42,0.06); }
.topbar h1 { margin: 0; color: #f38020; font-size: 26px; }
.topbar p { margin: 6px 0 0; color: #667085; }
.token-pill { white-space: nowrap; border-radius: 999px; padding: 8px 12px; background: #fef3e9; color: #f38020; font-weight: 700; font-size: 13px; }
.token-pill.ok { background: #ecfdf3; color: #16803c; }

.panel { display: none; margin-top: 18px; }
.panel.active { display: block; }
.card, .log-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 22px; box-shadow: 0 4px 18px rgba(15,23,42,0.05); }
.card h2 { margin: 0 0 8px; font-size: 20px; color: #111827; }
.muted { color: #667085; margin: 0 0 16px; line-height: 1.6; font-size: 14px; }
.inline-form { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; }
.quick-grid { margin-top: 16px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.mini-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 16px; min-height: 96px; }
.mini-card b { display: block; margin-bottom: 8px; color: #111827; }
.mini-card span { color: #667085; font-size: 14px; line-height: 1.5; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.zone-list { border: 1px solid #e5e7eb; border-radius: 8px; background: #fbfcfe; max-height: 480px; overflow-y: auto; margin-top: 14px; }
.load-progress { display: none; height: 10px; border-radius: 999px; overflow: hidden; background: #e5e7eb; margin-top: 14px; }
.load-progress div { height: 100%; width: 0%; background: #f38020; transition: width 0.25s; }
.load-progress.active { display: block; }
.zone-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 12px; border-bottom: 1px solid #eef1f5; font-size: 14px; }
.zone-row:last-child { border-bottom: 0; }
.zone-row b { display: block; overflow-wrap: anywhere; }
.zone-row span { display: block; color: #667085; margin-top: 3px; }
.zone-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.zone-actions button { width: auto; padding: 7px 9px; border-radius: 6px; font-size: 12px; }
.zone-actions .danger-small { background: #d93025; }
.zone-actions .danger-small:hover { background: #bd261d; }
.inline-panel { grid-column: 1 / -1; background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px; margin-top: 4px; }
.dns-record-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid #eef1f5; }
.dns-record-row:last-child { border-bottom: 0; }
.dns-record-row b { font-size: 13px; }
.dns-record-row span { overflow-wrap: anywhere; }
.inline-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid #eef1f5; }
.dns-panel-hint { color: #667085; font-size: 13px; line-height: 1.5; }
.inline-tools button, .record-actions button { width: auto; padding: 7px 9px; border-radius: 6px; font-size: 12px; }
.record-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.record-actions button { background: #1890ff; }
.record-actions button:hover { background: #0f7dd8; }
.record-actions .danger-small { background: #d93025; }
.record-actions .danger-small:hover { background: #bd261d; }
.muted-line { color: #667085; font-size: 13px; padding: 8px 0; }
.switch-line { display: flex; align-items: center; gap: 7px; margin: 0; white-space: nowrap; font-weight: 700; }
.switch-line input { width: auto; }
.inline-form-mini label { margin-top: 0; }
.inline-form-mini div { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.inline-form-mini p { margin: 8px 0 0; color: #667085; font-size: 13px; }
.inline-check { margin: 10px 0 0; padding: 0; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,0.45); display: grid; place-items: center; padding: 18px; z-index: 50; }
.modal-card { width: min(520px, 100%); background: #fff; border-radius: 12px; padding: 22px; box-shadow: 0 18px 48px rgba(15,23,42,0.24); }
.modal-card h3 { margin: 0 0 12px; color: #111827; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.modal-actions button:first-child { background: #667085; }
.modal-check { padding: 0; margin-top: 14px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 180px; gap: 14px; align-items: end; }
.check-row { display: flex; gap: 8px; align-items: center; padding: 12px 0; margin: 0; }
.check-row input { width: auto; }
.danger-form button { background: #d93025; }
.danger-form button:hover { background: #bd261d; }

.log-card { margin-top: 18px; padding: 0; overflow: hidden; }
.log-title { padding: 12px 16px; background: #111827; color: #fff; font-weight: 700; }
.log-box { min-height: 240px; max-height: 340px; overflow-y: auto; padding: 15px; background: #282c34; color: #abb2bf; font-family: Consolas, monospace; font-size: 13px; line-height: 1.7; }
.success { color: #98c379; }
.error { color: #e06c75; }
.info { color: #61afef; }

@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .logout { margin-top: 0; }
    .topbar, .section-head { align-items: flex-start; flex-direction: column; }
    .quick-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .inline-form { grid-template-columns: 1fr; }
    .zone-row { grid-template-columns: 1fr; }
    .zone-actions { justify-content: flex-start; }
    .dns-record-row, .inline-form-mini div { grid-template-columns: 1fr; }
    .record-actions, .inline-tools { justify-content: flex-start; align-items: flex-start; }
    .inline-tools { flex-direction: column; }
}
