:root {
    --primary: #0069B3;
    --primary-dark: #004f87;
    --primary-light: #e8f5fd;
    --primary-soft: #cfeafd;
    --primary-border: #a8d8f4;
    --text: #0f172a;
    --muted: #64748b;
    --border: #dbe4ee;
    --danger: #b91c1c;
    --danger-bg: #fef2f2;
    --success: #075985;
    --success-bg: #e8f5fd;
    --card: #ffffff;
    --bg: #f4f8fc;
    --shadow: 0 18px 45px rgba(15, 23, 42, .12);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
}

a { color: var(--primary); }

.public-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top, rgba(0,105,179,.12), transparent 36%),
        linear-gradient(180deg, #f7fbff 0%, #eef6fc 100%);
}

.public-wrap {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 18px 12px;
}

.public-card {
    width: min(780px, 100%);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 24px 18px;
    text-align: center;
}

.logo {
    max-width: 118px;
    max-height: 118px;
    object-fit: contain;
    margin: 0 auto 12px;
    display: block;
}

.representative-name {
    margin: 0 0 8px;
    color: var(--primary);
    font-weight: 800;
    letter-spacing: .01em;
}

h1 {
    font-size: clamp(27px, 7vw, 42px);
    line-height: 1.16;
    margin: 0 0 14px;
    color: #08233e;
}

h2 {
    font-size: 25px;
    line-height: 1.2;
    color: #08233e;
    margin: 18px 0 8px;
}

.lead {
    max-width: 660px;
    margin: 0 auto 14px;
    color: #475569;
    font-size: 16px;
    line-height: 1.65;
}

.info-box,
.alert {
    text-align: left;
    border-radius: 16px;
    padding: 14px 15px;
    margin: 16px 0;
    line-height: 1.55;
    font-size: 15px;
}

.info-box {
    background: var(--primary-light);
    border: 1px solid var(--primary-border);
    color: #073b63;
}

.alert.success {
    background: var(--success-bg);
    border: 1px solid var(--primary-border);
    color: var(--success);
}

.alert.error {
    background: var(--danger-bg);
    border: 1px solid #fecaca;
    color: var(--danger);
}

.alert.info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e3a8a;
}

.public-form {
    text-align: left;
    margin-top: 18px;
}

.form-row { margin-bottom: 14px; }
.form-row.inline { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }

label {
    display: block;
    font-weight: 800;
    color: #172033;
    margin-bottom: 7px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 13px;
    padding: 12px 13px;
    font: inherit;
    color: var(--text);
    background: #fff;
    outline: none;
}

input,
select { min-height: 48px; }
textarea { min-height: 110px; resize: vertical; }

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0,105,179,.12);
}

button,
.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    border: 0;
    border-radius: 13px;
    padding: 12px 18px;
    background: var(--primary);
    color: #fff;
    font-size: 15px;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
}

button:hover,
.btn:hover { background: var(--primary-dark); color: #fff; }

button.full { width: 100%; }

.btn.light,
button.light { background: var(--primary-light); color: var(--primary-dark); }
.btn.light:hover,
button.light:hover { background: var(--primary-soft); color: var(--primary-dark); }
.btn.secondary,
button.secondary { background: #f1f5f9; color: #172033; }
.btn.secondary:hover,
button.secondary:hover { background: #e2e8f0; color: #172033; }
.btn.danger,
button.danger { background: #fee2e2; color: #991b1b; }
.btn.danger:hover,
button.danger:hover { background: #fecaca; color: #7f1d1d; }
.btn.small,
button.small { min-height: 36px; padding: 8px 11px; border-radius: 10px; font-size: 13px; }

.muted { color: var(--muted); font-size: 14px; margin: 0; }

.video-shell {
    background: #000;
    overflow: hidden;
    border-radius: 18px;
    margin: 18px auto 0;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .18);
    width: 100%;
}

.video-shell.landscape {
    aspect-ratio: 16 / 9;
    max-width: 850px;
}

.video-shell.portrait {
    aspect-ratio: 9 / 16;
    max-width: min(430px, 100%);
    max-height: 78vh;
}

.video-shell video,
.video-shell iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #000;
}

.video-shell video { object-fit: contain; }

.video-note {
    font-size: 13px;
    color: var(--muted);
    margin: 10px 0 0;
    line-height: 1.45;
}

.video-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.footer {
    margin-top: 24px;
    font-size: 13px;
    color: var(--muted);
}

/* Admin */
.admin-body { background: #eef4fa; }
.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 22px;
    background: #08233e;
    color: #fff;
    box-shadow: 0 4px 20px rgba(15, 23, 42, .14);
}

.admin-topbar strong { display: block; font-size: 16px; }
.admin-topbar span { display: block; color: #cbd5e1; font-size: 12px; margin-top: 2px; }
.admin-topbar nav { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.admin-topbar nav a {
    color: #dbeafe;
    text-decoration: none;
    background: rgba(255,255,255,.08);
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 14px;
}
.admin-topbar nav a:hover { background: rgba(255,255,255,.16); color: #fff; }

.admin-container {
    width: min(1180px, calc(100% - 24px));
    margin: 22px auto 50px;
}

.admin-card,
.login-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 12px 34px rgba(15,23,42,.08);
    padding: 20px;
    margin-bottom: 18px;
}

.admin-card h1,
.admin-card h2,
.login-card h1 { margin-top: 0; }

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.stat {
    background: var(--primary-light);
    border: 1px solid var(--primary-border);
    border-radius: 18px;
    padding: 18px;
}
.stat strong { display: block; font-size: 34px; color: var(--primary-dark); }
.stat span { color: #334155; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 11px 10px; border-bottom: 1px solid #e2e8f0; text-align: left; vertical-align: top; }
th { color: #334155; font-size: 13px; background: #f8fafc; }
td.actions { white-space: nowrap; }

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 800;
    background: var(--primary-light);
    color: var(--primary-dark);
    border: 1px solid var(--primary-border);
}
.badge.gray { background: #f1f5f9; color: #334155; border-color: #e2e8f0; }
.badge.red { background: #fee2e2; color: #991b1b; border-color: #fecaca; }

.help {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
    margin: 6px 0 0;
}

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-card { width: min(460px, 100%); margin: 0; }
.logo-preview { max-width: 130px; max-height: 90px; object-fit: contain; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 8px; }

@media (max-width: 680px) {
    .public-wrap { padding: 14px 8px; }
    .public-card { padding: 20px 12px; border-radius: 22px; }
    .video-shell.landscape {
        width: calc(100vw - 20px);
        max-width: calc(100vw - 20px);
        margin-left: 50%;
        transform: translateX(-50%);
        border-radius: 14px;
    }
    .video-shell.portrait {
        max-width: min(360px, calc(100vw - 28px));
    }
    .admin-topbar { position: static; flex-direction: column; align-items: flex-start; padding: 14px; }
    .admin-topbar nav { justify-content: flex-start; }
    .admin-container { width: min(100% - 16px, 1180px); margin-top: 14px; }
    .admin-card { padding: 15px; border-radius: 16px; }
}
