:root {
    --orange: #f45112;
    --orange-deep: #c93b05;
    --ink: #182025;
    --steel: #44515a;
    --mist: #eef1f2;
    --paper: #fbfaf7;
    --white: #fff;
    --line: #dce1e3;
    --danger: #a42b25;
    --shadow: 0 18px 60px rgba(14, 23, 28, .16);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    margin: 0;
    color: var(--ink);
    background: var(--mist);
    font-family: Bahnschrift, "Aptos Display", "Segoe UI", sans-serif;
}
button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }

.eyebrow {
    margin: 0 0 8px;
    color: var(--orange);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .15em;
    text-transform: uppercase;
}
.muted { color: #71808a; line-height: 1.55; }
.is-hidden { display: none !important; }

.button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 3px;
    padding: 0 18px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .045em;
    text-decoration: none;
    text-transform: uppercase;
    transition: transform .18s ease, background .18s ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary { color: var(--white); background: var(--orange); }
.button-primary:hover { background: var(--orange-deep); }
.button-dark { color: var(--white); background: var(--ink); }
.button-ghost { color: var(--ink); background: #edf0f1; }
.button-secondary { width: 100%; color: var(--white); background: var(--ink); }
.button-secondary:hover { background: #0d1418; }
.button-danger { width: 100%; margin-top: 12px; color: var(--danger); background: #fae9e7; }
.button-publish {
    width: 100%;
    min-height: 64px;
    border-radius: 0;
    color: var(--white);
    background: linear-gradient(135deg, var(--orange), #ff7a1a);
    box-shadow: 0 15px 32px rgba(244, 81, 18, .28);
    font-size: 18px;
    letter-spacing: .12em;
}
.button-publish:hover { background: linear-gradient(135deg, var(--orange-deep), var(--orange)); }
.button-publish:disabled { cursor: not-allowed; opacity: .58; transform: none; }

.admin-auth-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 32px;
    background:
        linear-gradient(120deg, rgba(244, 81, 18, .09), transparent 42%),
        repeating-linear-gradient(90deg, rgba(24, 32, 37, .025) 0 1px, transparent 1px 44px),
        var(--mist);
}
.auth-shell {
    display: grid;
    width: min(1060px, 100%);
    min-height: 650px;
    grid-template-columns: 1.12fr .88fr;
    overflow: hidden;
    background: var(--white);
    box-shadow: var(--shadow);
}
.auth-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 76px;
    color: var(--white);
    background:
        linear-gradient(145deg, rgba(24, 32, 37, .96), rgba(24, 32, 37, .84)),
        url("../../assets/images/informatica-1920x785.png") center/cover;
}
.auth-brand::after {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 170px;
    height: 170px;
    border: 28px solid rgba(244, 81, 18, .78);
    content: "";
    transform: translate(42%, 42%) rotate(18deg);
}
.brand-mark {
    display: grid;
    width: 64px;
    height: 64px;
    margin-bottom: 42px;
    place-items: center;
    border: 2px solid var(--orange);
    color: var(--orange);
    font-size: 21px;
    font-weight: 900;
}
.auth-brand h1 { max-width: 520px; margin: 0 0 22px; font-size: clamp(38px, 4vw, 62px); line-height: .96; letter-spacing: -.04em; }
.auth-brand > p:not(.eyebrow) { max-width: 520px; margin-bottom: 36px; color: #cbd2d5; line-height: 1.7; }
.auth-feature { display: flex; align-items: center; gap: 18px; margin-top: 14px; color: #e4e8e9; font-size: 14px; }
.auth-feature span { color: var(--orange); font-size: 11px; font-weight: 900; }
.auth-card { display: flex; flex-direction: column; justify-content: center; padding: 70px 58px; }
.auth-card h2 { margin: 0; font-size: 34px; letter-spacing: -.03em; }
.auth-form, .settings-form, .editor-form { display: grid; gap: 18px; margin-top: 28px; }
label { display: grid; gap: 8px; color: var(--steel); font-size: 13px; font-weight: 700; }
input, textarea, select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 3px;
    outline: none;
    background: var(--white);
    color: var(--ink);
}
input, select { min-height: 46px; padding: 0 13px; }
textarea { resize: vertical; padding: 13px; line-height: 1.55; }
input:focus, textarea:focus, select:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(244, 81, 18, .11); }
.alert { margin-top: 22px; padding: 13px 15px; font-size: 13px; line-height: 1.5; }
.alert-error { color: #7e211c; background: #fae9e7; }

.admin-editor-page { height: 100vh; overflow: hidden; }
.admin-app { display: grid; height: 100vh; grid-template-rows: 68px 1fr; }
.admin-topbar {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
    border-bottom: 1px solid #11191d;
    color: var(--white);
    background: var(--ink);
}
.admin-logo { display: grid; grid-template-columns: 36px auto; color: var(--white); text-decoration: none; }
.admin-logo span { display: grid; grid-row: span 2; width: 30px; height: 30px; place-items: center; border: 1px solid var(--orange); color: var(--orange); font-size: 11px; font-weight: 900; }
.admin-logo strong { font-size: 14px; letter-spacing: .04em; }
.admin-logo small { color: #849198; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.topbar-actions form { margin: 0; }
.admin-topbar .button-ghost { color: #d5dbde; background: #2a343a; }

.admin-workspace { display: grid; min-height: 0; grid-template-columns: minmax(0, 1fr) 355px; }
.preview-column { display: grid; min-width: 0; min-height: 0; grid-template-rows: 64px 1fr; }
.preview-toolbar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0 20px;
    border-bottom: 1px solid var(--line);
    background: var(--paper);
}
.page-picker { display: flex; align-items: center; gap: 10px; }
.page-picker select { width: 230px; min-height: 38px; }
.maintenance-toggle {
    display: grid;
    grid-template-columns: auto auto;
    align-items: center;
    gap: 6px 10px;
    min-width: 285px;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid rgba(244, 81, 18, .32);
    background: linear-gradient(135deg, rgba(244, 81, 18, .1), rgba(255, 255, 255, .78));
}
.maintenance-check {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ink);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .07em;
}
.maintenance-check input {
    width: 18px;
    min-height: 18px;
    accent-color: var(--orange);
}
.maintenance-check span { white-space: nowrap; }
.button-maintenance {
    min-height: 34px;
    padding: 0 12px;
    color: var(--white);
    background: var(--orange);
    font-size: 11px;
}
.button-maintenance:hover { background: var(--orange-deep); }
.button-maintenance:disabled { cursor: not-allowed; opacity: .6; transform: none; }
.maintenance-toggle small {
    grid-column: 1 / -1;
    color: #69777f;
    font-size: 11px;
    line-height: 1.2;
}
.maintenance-toggle.is-active {
    border-color: rgba(164, 43, 37, .38);
    background: linear-gradient(135deg, rgba(164, 43, 37, .13), rgba(255, 255, 255, .78));
}
.maintenance-toggle.is-active small { color: var(--danger); font-weight: 800; }
.device-switch { display: flex; margin-left: auto; padding: 3px; background: #e3e7e8; }
.device-switch button { min-height: 32px; border: 0; padding: 0 13px; color: #68767e; background: transparent; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.device-switch button.is-active { color: var(--ink); background: var(--white); box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); background: var(--white); font-size: 21px; }
.preview-stage { min-height: 0; overflow: auto; padding: 22px; background: #cfd5d7; }
.preview-frame-wrap { width: 100%; height: 100%; min-height: 560px; margin: 0 auto; overflow: hidden; background: var(--white); box-shadow: 0 10px 34px rgba(20, 31, 36, .2); transition: width .25s ease; }
.preview-frame-wrap.is-tablet { width: min(820px, 100%); }
.preview-frame-wrap.is-mobile { width: min(390px, 100%); }
.preview-frame-wrap iframe { display: block; width: 100%; height: 100%; min-height: 560px; border: 0; background: var(--white); }

.inspector { overflow-y: auto; padding: 30px 25px; border-left: 1px solid var(--line); background: var(--white); }
.inspector h2 { margin: 0; font-size: 25px; letter-spacing: -.025em; }
.publish-card {
    display: grid;
    gap: 11px;
    margin: 24px 0 26px;
    padding: 18px;
    border: 1px solid rgba(244, 81, 18, .28);
    background:
        linear-gradient(135deg, rgba(244, 81, 18, .1), rgba(24, 32, 37, .04)),
        var(--paper);
}
.tool-card {
    display: grid;
    gap: 12px;
    margin: 0 0 18px;
    padding: 16px;
    border: 1px solid var(--line);
    background: #f7f8f8;
}
.tool-card > span {
    color: var(--orange);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.tool-card small {
    color: #74818a;
    font-size: 12px;
    line-height: 1.45;
}
.add-block-form textarea,
.map-form textarea { min-height: 92px; }
.publish-card span {
    color: var(--ink);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .12em;
    text-align: center;
    text-transform: uppercase;
}
.publish-card small {
    color: #74818a;
    font-size: 12px;
    line-height: 1.45;
    text-align: center;
}
.empty-selection { margin-top: 34px; padding: 28px; border: 1px dashed #bac3c7; text-align: center; background: #f7f8f8; }
.empty-selection p { margin-bottom: 0; color: #7c898f; font-size: 13px; line-height: 1.5; }
.selection-symbol { display: grid; width: 46px; height: 46px; margin: 0 auto 16px; place-items: center; border: 1px solid var(--orange); color: var(--orange); font-size: 25px; }
.character-count { margin-top: -12px; color: #88949a; font-size: 11px; text-align: right; }
.image-preview { display: grid; min-height: 160px; place-items: center; overflow: hidden; border: 1px solid var(--line); background: #eef1f2; }
.image-preview img { display: block; max-width: 100%; max-height: 230px; object-fit: contain; }
.file-drop { padding: 20px; border: 1px dashed #aeb8bd; text-align: center; background: #f7f8f8; }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-drop span { color: var(--orange); }
.file-drop small { color: #89949a; }
.status-message { min-height: 22px; margin-top: 16px; font-size: 13px; line-height: 1.5; }
.status-message.is-success { color: #216b46; }
.status-message.is-error { color: var(--danger); }

.settings-dialog,
.site-preview-dialog { border: 0; padding: 0; box-shadow: var(--shadow); }
.settings-dialog { width: min(500px, calc(100% - 32px)); }
.site-preview-dialog {
    width: min(1180px, calc(100vw - 36px));
    height: min(820px, calc(100vh - 36px));
    background: var(--white);
}
.settings-dialog::backdrop,
.site-preview-dialog::backdrop { background: rgba(12, 18, 21, .72); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; color: var(--white); background: var(--ink); }
.dialog-head h2 { margin: 0; font-size: 20px; }
.dialog-head button { border: 0; color: var(--white); background: transparent; font-size: 28px; }
.settings-form { padding: 6px 24px 26px; }
.site-preview-dialog .dialog-head { height: 72px; }
.site-preview-dialog .eyebrow { margin: 0 0 4px; }
.site-preview-dialog iframe {
    display: block;
    width: 100%;
    height: calc(100% - 72px);
    border: 0;
    background: var(--white);
}

@media (max-width: 980px) {
    .admin-workspace { grid-template-columns: minmax(0, 1fr) 310px; }
    .auth-brand { padding: 50px; }
}
@media (max-width: 760px) {
    .admin-auth-page { padding: 0; }
    .auth-shell { min-height: 100vh; grid-template-columns: 1fr; }
    .auth-brand { display: none; }
    .auth-card { padding: 42px 28px; }
    .admin-editor-page { height: auto; overflow: auto; }
    .admin-app { height: auto; min-height: 100vh; grid-template-rows: auto 1fr; }
    .admin-topbar { align-items: flex-start; padding: 14px; gap: 12px; }
    .topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
    .admin-topbar .button { min-height: 36px; padding: 0 10px; font-size: 10px; }
    .admin-workspace { grid-template-columns: 1fr; }
    .preview-column { height: 72vh; }
    .preview-toolbar { gap: 8px; padding: 8px; }
    .page-picker { flex: 1; }
    .page-picker select { width: 100%; }
    .maintenance-toggle { min-width: 100%; order: 3; }
    .device-switch { display: none; }
    .preview-stage { padding: 8px; }
    .inspector { border-top: 1px solid var(--line); border-left: 0; }
}
