:root {
    --ink: #050807;
    --muted: #526863;
    --paper: #ffffff;
    --canvas: #f2f3f4;
    --mint: #b9e9e1;
    --mint-soft: #e5f8f4;
    --line: #a7ddd4;
    --teal: #00bea6;
    --teal-dark: #007d70;
    --teal-deep: #005f57;
    --green: #19875f;
    --red: #cf3d50;
    --yellow: #d6a11d;
    --blue: #0071c1;
    --shadow: 0 14px 36px rgba(0, 95, 87, .12);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font-family: Arial, sans-serif;
}

a { color: inherit; }

.topbar {
    min-height: 76px;
    padding: 10px 24px;
    background: var(--paper);
    color: var(--ink);
    border-bottom: 4px solid var(--teal);
    box-shadow: 0 8px 26px rgba(0, 95, 87, .10);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    position: relative;
    z-index: 60;
}

.brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    flex: 0 0 auto;
}

.brand-logo {
    display: block;
    width: auto;
    max-width: 180px;
    height: 54px;
    object-fit: contain;
    object-position: left center;
}

.nav {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.nav > a,
.nav-trigger {
    padding: 10px 12px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--ink);
    text-decoration: none;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.nav > a:hover,
.nav-trigger:hover,
.nav-group:focus-within .nav-trigger {
    background: var(--mint-soft);
    color: var(--teal-deep);
}

.nav > a:last-child {
    background: var(--ink);
    color: #fff;
}

.nav > a:last-child:hover { background: var(--teal-deep); }
.nav-group { position: relative; }

.nav-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 70;
    min-width: 200px;
    padding: 8px;
    background: var(--paper);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 11px;
    box-shadow: var(--shadow);
}

.nav-group:hover .nav-menu,
.nav-group:focus-within .nav-menu { display: block; }

.nav-menu a {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 800;
}

.nav-menu a:hover {
    background: var(--mint-soft);
    color: var(--teal-deep);
}

.container {
    width: min(1200px, calc(100% - 28px));
    margin: 26px auto;
}

.card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 22px;
    box-shadow: var(--shadow);
}

.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.page-head h1,
.page-head h2 { margin: 0; }

.eyebrow {
    color: var(--teal-dark);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.btn {
    display: inline-block;
    border: 0;
    border-radius: 10px;
    padding: 10px 15px;
    background: var(--teal-dark);
    color: #fff;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
    transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}

.btn:hover {
    background: var(--teal-deep);
    box-shadow: 0 7px 18px rgba(0, 95, 87, .18);
    transform: translateY(-1px);
}

.btn.secondary { background: var(--ink); }
.btn.secondary:hover { background: #26302e; }
.btn.success { background: var(--green); }
.btn.danger { background: var(--red); }
.btn.warning { background: var(--yellow); color: var(--ink); }
.btn.light { background: var(--mint-soft); color: var(--teal-deep); }
.btn.small { padding: 7px 9px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

input,
select {
    width: 100%;
    border: 1px solid #9ccfc7;
    border-radius: 9px;
    padding: 11px 12px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

input:focus,
select:focus {
    border-color: var(--teal);
    outline: 3px solid rgba(0, 190, 166, .16);
}

button:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(0, 190, 166, .34);
    outline-offset: 2px;
}

label { display: block; margin-bottom: 6px; font-weight: 800; }
.field { margin-bottom: 15px; }
.help { color: var(--muted); font-size: 13px; font-weight: 700; }

.alert {
    border-radius: 10px;
    padding: 12px 14px;
    margin: 0 0 16px;
    font-weight: 800;
}

.alert.info { background: #dff5f3; color: #075e62; }
.alert.success { background: #d9f4e7; color: #0b6042; }
.alert.error { background: #fde7ea; color: #8e2131; }
.alert.warning { background: #fff2c9; color: #6b5000; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px; border-bottom: 1px solid #d7ebe7; text-align: left; vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; color: var(--muted); }

.badge {
    display: inline-block;
    padding: 5px 8px;
    border-radius: 999px;
    background: var(--mint-soft);
    color: var(--teal-deep);
    font-weight: 900;
    font-size: 12px;
}

.badge.success { background: #d9f4e7; color: #0b6042; }
.badge.danger { background: #fde7ea; color: #8e2131; }

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card { width: min(460px, 100%); }
.auth-card h1 { margin: 8px 0 20px; }
.auth-brand { text-align: center; margin: 0 0 24px; }
.auth-brand img { display: inline-block; width: min(280px, 86%); height: auto; }
.auth-submit { width: 100%; }
.auth-links { margin-top: 18px; text-align: center; }
.auth-links a { color: var(--teal-deep); font-weight: 800; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.screen-logo { display: block; width: min(250px, 72%); height: auto; margin: 0 auto 22px; }

.footer {
    padding: 26px;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.footer strong { color: var(--teal-deep); }

.toolbar,
.filter-form,
.inline-edit,
.cell-actions,
.password-form,
.modal-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar { flex-wrap: wrap; justify-content: flex-end; }
.filter-form { align-items: flex-end; flex-wrap: wrap; }
.filter-form select { min-width: 190px; }
.data-card { width: 100%; }
.data-card > .page-head { margin-bottom: 8px; }
.admin-table { table-layout: auto; }
.admin-table th, .admin-table td { vertical-align: middle; }
.inline-edit { min-width: 300px; }
.inline-edit input { min-width: 190px; }
.cell-actions { flex-wrap: wrap; }
.cell-actions form { margin: 0; }
.password-form { min-width: 270px; }
.password-form input { min-width: 160px; }

dialog.modal {
    width: min(560px, calc(100% - 28px));
    max-height: calc(100vh - 32px);
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 24px;
    background: #fff;
    color: var(--ink);
    box-shadow: 0 28px 90px rgba(0, 32, 29, .34);
}

dialog.modal.modal-wide { width: min(760px, calc(100% - 28px)); }
dialog.modal::backdrop { background: rgba(0, 38, 34, .62); backdrop-filter: blur(3px); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.modal-head h2 { margin: 4px 0 0; font-size: 28px; }
.modal-close { border: 0; background: var(--mint-soft); color: var(--teal-deep); width: 38px; height: 38px; border-radius: 50%; font-size: 25px; line-height: 1; cursor: pointer; }
.modal-actions { justify-content: flex-end; margin-top: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }

.local-logo-preview {
    width: 100%;
    min-height: 112px;
    margin: 0 0 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.local-logo-preview img {
    display: block;
    max-width: 260px;
    max-height: 88px;
    object-fit: contain;
}

.screen-style-fieldset {
    margin: 4px 0 18px;
    padding: 0;
    border: 0;
}

.screen-style-fieldset legend {
    margin-bottom: 9px;
    font-weight: 800;
}

.screen-style-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 7px;
}

.screen-style-option {
    margin: 0;
    padding: 10px;
    border: 2px solid #c6ddd9;
    border-radius: 11px;
    background: #fff;
    cursor: pointer;
}

.screen-style-option:has(input:checked) {
    border-color: var(--teal-dark);
    box-shadow: 0 0 0 3px rgba(0, 190, 166, .13);
}

.screen-style-option input { width: auto; margin-right: 5px; }
.screen-style-name { font-size: 13px; font-weight: 900; }
.screen-style-preview { height: 86px; margin-top: 8px; padding: 7px; border-radius: 7px; background: #edf0f0; display: grid; gap: 5px; overflow: hidden; }
.preview-style1 { grid-template-rows: 25px 1fr; }
.preview-called { border-radius: 4px; background: var(--blue); color: #fff; display: grid; place-items: center; font-size: 9px; }
.preview-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.preview-columns i, .preview-style2 i { display: block; border-radius: 4px; background: #fff; border-top: 12px solid #f4c430; }
.preview-columns i:last-child { border-top-color: var(--green); }
.preview-style2 { grid-template-columns: repeat(3, 1fr); }
.preview-style2 i:first-child { border-top-color: var(--blue); }
.preview-style2 i:nth-child(2) { border-top-color: #f4c430; }
.preview-style2 i:last-child { border-top-color: var(--green); }

@media (max-width: 760px) {
    .grid.two { grid-template-columns: 1fr; }
    .topbar { align-items: flex-start; flex-direction: column; padding: 12px 16px; }
    .brand-logo { max-width: 150px; height: 48px; }
    .nav { width: 100%; }
    .nav-menu { left: 0; right: auto; }
    .toolbar { width: 100%; justify-content: flex-start; }
    .filter-form { width: 100%; }
    .filter-form > div { flex: 1; min-width: 150px; }
    .filter-form select { min-width: 0; }
    .admin-table { min-width: 820px; }
    .inline-edit { min-width: 250px; }
    .modal-actions { flex-direction: column-reverse; }
    .modal-actions .btn { width: 100%; }
}

@media (max-width: 600px) {
    .form-grid { grid-template-columns: 1fr; }
    .screen-style-options { grid-template-columns: 1fr; }
}
