:root {
    color-scheme: light;
    --ink: #172036;
    --muted: #68738b;
    --line: #dfe5ef;
    --surface: rgba(255, 255, 255, .88);
    --blue: #1769ff;
    --blue-dark: #0f4dcc;
    --cyan: #0fb9c7;
    --danger: #c5334a;
    --success: #087d5d;
    --shadow: 0 24px 70px rgba(27, 47, 85, .12);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at 8% 0%, rgba(23, 105, 255, .13), transparent 33rem),
        radial-gradient(circle at 94% 18%, rgba(15, 185, 199, .12), transparent 30rem),
        #f5f7fb;
}
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 72px;
    padding: 12px clamp(20px, 5vw, 72px);
    border-bottom: 1px solid rgba(223, 229, 239, .8);
    background: rgba(250, 251, 254, .82);
    backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); font-weight: 800; text-decoration: none; }
.brand-mark {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 18px;
    color: white;
    font-weight: 900;
    letter-spacing: -.04em;
    background: linear-gradient(145deg, var(--blue), var(--cyan));
    box-shadow: 0 12px 30px rgba(23, 105, 255, .25);
}
.brand-mark.small { width: 40px; height: 40px; border-radius: 13px; font-size: .82rem; }
.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 70px 0 100px; }
.hero { max-width: 780px; margin-bottom: 38px; }
.eyebrow { margin: 0 0 12px; color: var(--blue); font-size: .76rem; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(2.4rem, 6vw, 5rem); line-height: .98; letter-spacing: -.06em; }
.hero p:last-child { max-width: 700px; margin: 24px 0 0; color: var(--muted); font-size: clamp(1rem, 2vw, 1.2rem); line-height: 1.65; }
.panel {
    margin-top: 24px;
    padding: clamp(22px, 4vw, 38px);
    border: 1px solid rgba(255, 255, 255, .95);
    border-radius: 28px;
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}
.panel-heading, .panel-heading > div, .form-footer, .progress-meta { display: flex; align-items: center; }
.panel-heading { justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.panel-heading > div { gap: 12px; }
.panel h2 { margin: 0; font-size: 1.3rem; letter-spacing: -.025em; }
.step { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: var(--blue); background: #eaf1ff; font-size: .72rem; font-weight: 900; }
.limit { padding: 7px 11px; border-radius: 999px; color: var(--muted); background: #f0f3f8; font-size: .78rem; font-weight: 700; }
textarea, input[type="text"], input[type="password"] {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 16px;
    color: var(--ink);
    background: #fbfcfe;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
textarea { min-height: 210px; padding: 20px; resize: vertical; line-height: 1.7; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
input[type="text"], input[type="password"] { padding: 13px 14px; }
textarea:focus, input:focus { border-color: var(--blue); background: white; box-shadow: 0 0 0 4px rgba(23, 105, 255, .12); }
.form-footer { flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.form-footer .button.primary { margin-left: auto; }
.file-button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 17px;
    border: 0;
    border-radius: 13px;
    cursor: pointer;
    font-weight: 800;
    text-decoration: none;
    transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}
.file-button { color: var(--ink); background: #edf1f7; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.button:hover, .file-button:hover { transform: translateY(-1px); }
.button.primary { color: white; background: linear-gradient(135deg, var(--blue), var(--blue-dark)); box-shadow: 0 10px 24px rgba(23, 105, 255, .2); }
.button.secondary { color: var(--blue); background: #eaf1ff; }
.button.ghost { color: var(--muted); background: transparent; }
.button.disabled { pointer-events: none; opacity: .48; }
.muted { color: var(--muted); }
.form-message { min-height: 1.3em; margin: 13px 0 0; color: var(--success); font-size: .9rem; }
.form-message.error { color: var(--danger); }
.progress-wrap { padding: 18px 20px; border-radius: 18px; background: #f5f7fb; }
.progress-meta { justify-content: space-between; margin-bottom: 10px; font-size: .88rem; }
.progress { height: 8px; overflow: hidden; border-radius: 99px; background: #e1e7f0; }
.progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--cyan)); transition: width .28s ease; }
.rate-note { margin: 10px 0 0; color: var(--muted); font-size: .75rem; }
.table-wrap { overflow-x: auto; margin: 24px -10px -8px; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: 14px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; }
.domain-cell { font-weight: 800; }
.nameserver-cell { white-space: pre-line; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; line-height: 1.55; }
.status { display: inline-flex; padding: 6px 9px; border-radius: 99px; font-size: .72rem; font-weight: 800; background: #eef1f6; }
.status.done { color: var(--success); background: #e1f6ef; }
.status.error { color: var(--danger); background: #fde9ed; }
.status.processing { color: var(--blue); background: #eaf1ff; }
.status.known { color: #12606a; background: #dff7f8; }
.status.active { color: var(--success); background: #e1f6ef; }
.status.cancelled { color: #667085; background: #e8ebf0; }
.known-row td { background: rgba(15, 185, 199, .075); }
.known-row td:first-child { box-shadow: inset 4px 0 0 var(--cyan); }
.inline-edit {
    padding: 5px 8px;
    border: 1px dashed #bdc7d8;
    border-radius: 9px;
    color: var(--muted);
    background: #f5f7fb;
    cursor: pointer;
    font-size: .78rem;
    font-weight: 750;
}
.inline-edit.manual { border-style: solid; color: #12606a; background: #e6f8f9; }
.inline-edit:hover { border-color: var(--blue); color: var(--blue); }
.inline-editor { display: grid; min-width: 190px; grid-template-columns: 1fr auto; gap: 6px; }
.inline-editor input { grid-column: 1 / -1; min-width: 150px; padding: 8px 9px; border-radius: 9px; }
.mini-save, .mini-cancel, .portfolio-toggle {
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font-size: .7rem;
    font-weight: 800;
}
.mini-save { padding: 7px 9px; color: white; background: var(--blue); }
.mini-cancel { padding: 7px 9px; color: var(--muted); background: #edf1f6; }
.denic-link { display: block; width: max-content; margin-top: 7px; color: var(--blue); font-size: .68rem; font-weight: 800; text-decoration: none; }
.denic-link:hover { text-decoration: underline; }
.portfolio-legend { display: flex; flex-wrap: wrap; gap: 16px; margin: -8px 0 18px; color: var(--muted); font-size: .76rem; font-weight: 700; }
.portfolio-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 9px; height: 9px; border-radius: 99px; }
.legend-dot.critical { background: #e5484d; }
.legend-dot.warning { background: #f59e0b; }
.legend-dot.cancelled { background: #98a2b3; }
.portfolio-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.portfolio-stat { display: grid; gap: 3px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: #f8fafc; }
.portfolio-stat strong { font-size: 1.5rem; letter-spacing: -.04em; }
.portfolio-stat span { color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.portfolio-stat.critical { border-color: #f2b8bc; background: #fff1f1; }
.portfolio-stat.critical strong { color: #c62f37; }
.portfolio-stat.warning { border-color: #f5d49b; background: #fff8e8; }
.portfolio-stat.warning strong { color: #ad6800; }
.portfolio-stat.cancelled { background: #f0f2f5; }
.portfolio-row.critical td { background: rgba(229, 72, 77, .085); }
.portfolio-row.critical td:first-child { box-shadow: inset 4px 0 0 #e5484d; }
.portfolio-row.warning td { background: rgba(245, 158, 11, .095); }
.portfolio-row.warning td:first-child { box-shadow: inset 4px 0 0 #f59e0b; }
.portfolio-row.cancelled td { color: #7b8495; background: rgba(152, 162, 179, .11); }
.portfolio-row.cancelled .domain-cell { text-decoration: line-through; }
.portfolio-row.cancelled td:first-child { box-shadow: inset 4px 0 0 #98a2b3; }
.renewal-hint { display: block; margin-top: 6px; font-size: .68rem; font-weight: 850; }
.renewal-hint.critical { color: #c62f37; }
.renewal-hint.warning { color: #ad6800; }
.portfolio-toggle { display: block; margin-top: 8px; padding: 7px 9px; color: var(--muted); background: #edf1f6; white-space: nowrap; }
.portfolio-toggle:hover { color: var(--blue); }
.empty-state { margin: 0; padding: 26px; border: 1px dashed var(--line); border-radius: 16px; color: var(--muted); text-align: center; }
.auth-page { display: grid; place-items: center; padding: 28px; }
.auth-card { width: min(460px, 100%); padding: clamp(28px, 6vw, 48px); border: 1px solid white; border-radius: 30px; background: var(--surface); box-shadow: var(--shadow); }
.auth-card h1 { margin-top: 24px; font-size: 2.4rem; }
.auth-card .eyebrow { margin-top: 28px; }
.auth-card form { display: grid; gap: 17px; margin-top: 26px; }
.auth-card label { display: grid; gap: 8px; font-size: .82rem; font-weight: 800; }
.auth-card .button { width: 100%; margin-top: 4px; }
.auth-card .button:disabled { cursor: not-allowed; opacity: .45; }
.alert { margin-top: 20px; padding: 13px 15px; border-radius: 13px; color: var(--danger); background: #fde9ed; line-height: 1.45; }
.requirements { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 20px; }
.requirement { padding: 6px 9px; border-radius: 99px; font-size: .72rem; font-weight: 800; }
.requirement.ok { color: var(--success); background: #e1f6ef; }
.requirement.bad { color: var(--danger); background: #fde9ed; }
.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; }

@media (max-width: 720px) {
    .shell { width: min(100% - 24px, 1180px); padding-top: 44px; }
    .panel { border-radius: 22px; }
    .form-footer .button.primary { width: 100%; margin-left: 0; }
    .topbar { padding-inline: 16px; }
    .topbar .brand > span:last-child { display: none; }
    .portfolio-stats { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
