:root {
    --accent: #1ebbf0;
    --accent-2: #39dfaa;
    --accent-dark: #23aadd;
    --gradient: linear-gradient(135deg, #1ebbf0 31%, #39dfaa 92%);
    --gradient-hover: linear-gradient(135deg, #23aadd 30%, #37ce9d 100%);
    --text: #686868;
    --heading: #333333;
    --bg: #f7f7f7;
    --surface: #ffffff;
    --divider: rgba(0, 0, 0, 0.08);
    --footer-bg: #1a1c20;
    --error: #e0364a;
    --success: #18a374;
    --radius: 6px;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Roboto", Helvetica, Arial, Verdana, sans-serif;
    font-size: 15px;
    line-height: 1.65;
    color: var(--text);
    background: var(--bg);
}

h1, h2, h3 { color: var(--heading); line-height: 1.25; margin: 0 0 .5em; }
a { color: var(--accent); }
img { max-width: 100%; display: block; }
.muted { color: #9a9a9a; font-weight: 400; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--divider);
    position: relative;
    z-index: 5;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 90px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--heading); }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { font-size: 17px; font-weight: 700; }
.brand-text small { color: var(--text); font-size: 13px; }
.logo-iocs { width: 64px; height: 64px; }
.logo-se { width: 64px; height: 64px; }
.header-right { display: flex; align-items: center; gap: 20px; }
.lang-switch { display: flex; padding: 3px; border-radius: 100px; background: rgba(30, 187, 240, .1); }
.lang-switch a {
    padding: 4px 12px;
    border-radius: 100px;
    color: var(--heading);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}
.lang-switch a.active { background: var(--gradient); color: #fff; }

/* Page title */
.page-title {
    background: var(--surface);
    border-bottom: 2px solid var(--divider);
    padding: 56px 0 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.page-title::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url("../img/iocs-black.png") center / 340px no-repeat;
    opacity: .035;
    pointer-events: none;
}
.page-title .container { position: relative; }
.eyebrow {
    display: inline-block;
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.page-title h1 { font-size: clamp(28px, 4.5vw, 44px); font-weight: 700; }
.page-title h1::after {
    content: "";
    display: block;
    width: 70px;
    height: 4px;
    margin: 18px auto 0;
    border-radius: 2px;
    background: var(--gradient);
}
.lead { max-width: 720px; margin: 18px auto 0; font-size: 16px; }

.filter-nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.filter-nav a {
    padding: 8px 20px;
    border-radius: 100px;
    background: rgba(30, 187, 240, .1);
    color: var(--heading);
    font-weight: 500;
    text-decoration: none;
    transition: background .2s, color .2s;
}
.filter-nav a:hover { background: var(--gradient); color: #fff; }

/* Main */
.main { padding: 40px 20px 160px; }
.category { margin-bottom: 56px; scroll-margin-top: 20px; }
.section-title {
    font-size: 26px;
    font-weight: 700;
    padding-bottom: 14px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--divider);
    position: relative;
}
.section-title::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 60px;
    height: 3px;
    background: var(--gradient);
}

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 28px; }

.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform .2s, box-shadow .2s, outline-color .2s;
    outline: 3px solid transparent;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0, 0, 0, .1); }
.card.selected { outline-color: var(--accent-2); }
.card-img { position: relative; aspect-ratio: 4 / 5; background: #eceff1; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.tag {
    position: absolute;
    left: 14px;
    top: 14px;
    padding: 3px 12px;
    border-radius: 100px;
    background: var(--gradient);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
}
.card-body { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.card-body h3 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.bio {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}
.link-btn {
    align-self: flex-start;
    background: none;
    border: 0;
    padding: 0;
    color: var(--accent);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}
.link-btn:hover { color: var(--accent-dark); text-decoration: underline; }
.link-btn[hidden] { display: none; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 22px;
    border: 0;
    border-radius: var(--radius);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background .2s, color .2s, box-shadow .2s;
}
.btn-primary { background: var(--gradient); color: #fff; }
.btn-primary:hover { background: var(--gradient-hover); }
.btn-primary:disabled { opacity: .6; cursor: wait; }
.btn-outline { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.btn-outline:hover { background: rgba(30, 187, 240, .08); }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { background: #c42b3e; }
.btn-light { background: #eef1f3; color: var(--heading); }
.btn-light:hover { background: #e2e6e9; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

.vote-choice { margin-top: auto; padding-top: 16px; display: block; }
.vote-choice input { position: absolute; opacity: 0; pointer-events: none; }
.vote-choice .btn { width: 100%; }
.vote-choice .when-on { display: none; }
.vote-choice input:checked + .btn { background: var(--gradient); color: #fff; box-shadow: none; }
.vote-choice input:checked + .btn .when-on { display: inline; }
.vote-choice input:checked + .btn .when-off { display: none; }
.vote-choice input:focus-visible + .btn { outline: 2px solid var(--heading); outline-offset: 2px; }

/* Vote bar */
.vote-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    background: var(--surface);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, .12);
    border-top: 3px solid var(--accent);
    padding: 16px 0;
    transform: translateY(110%);
    transition: transform .3s ease;
}
.vote-bar.active { transform: none; }
.vote-bar-inner { display: grid; grid-template-columns: 1fr auto; gap: 8px 24px; align-items: center; }
.vote-summary { display: flex; flex-wrap: wrap; gap: 4px 28px; color: var(--heading); }
.vote-email { display: flex; gap: 10px; }
.vote-hint { grid-column: 1 / -1; margin: 0; font-size: 12px; color: #9a9a9a; }
.vote-error { grid-column: 1 / -1; margin: 0; color: var(--error); font-weight: 500; }

input[type=email], input[type=text], input[type=password], input[type=number], textarea, select {
    font: inherit;
    color: var(--heading);
    padding: 10px 14px;
    border: 1px solid #d5d9dc;
    border-radius: var(--radius);
    background: #fff;
    width: 100%;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(30, 187, 240, .18); }
input.invalid { border-color: var(--error); box-shadow: 0 0 0 3px rgba(224, 54, 74, .15); }
.vote-email input { width: 300px; }

/* Alerts */
.alert, .notice {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    background: var(--surface);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--accent);
    color: var(--heading);
}
.alert-success { border-left-color: var(--success); background: #eafaf4; }
.alert-error { border-left-color: var(--error); background: #fdeef0; }
.alert-warning { border-left-color: #f0a91e; background: #fff7e6; }
.notice { text-align: center; padding: 28px; font-size: 16px; }

/* Dialog */
.bio-dialog {
    border: 0;
    border-radius: 10px;
    padding: 0;
    width: min(760px, calc(100% - 32px));
    max-height: calc(100vh - 48px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
    color: var(--text);
}
.bio-dialog::backdrop { background: rgba(26, 28, 32, .7); }
.bio-dialog[open] { display: grid; grid-template-columns: 280px 1fr; }
.bio-dialog img { width: 100%; height: 100%; max-height: calc(100vh - 48px); object-fit: cover; }
.dialog-body { padding: 32px; overflow-y: auto; max-height: calc(100vh - 48px); }
.dialog-body h3 { font-size: 24px; }
.dialog-close {
    position: absolute;
    right: 10px;
    top: 8px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .9);
    font-size: 26px;
    line-height: 1;
    color: var(--heading);
    cursor: pointer;
}

/* Footer */
.site-footer { background: var(--footer-bg); color: rgba(255, 255, 255, .7); padding: 36px 0; }
.footer-inner { display: flex; flex-direction: column; align-items: center; gap: 22px; text-align: center; }
.footer-logos { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 14px; }
.logo-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    padding: 6px;
    border-radius: 8px;
    background: #fff;
}
.logo-tile img { max-width: 100%; max-height: 100%; }
.logo-tile.logo-main { width: 110px; height: 110px; padding: 0; margin: 0 10px; background: none; }
.footer-text { display: flex; flex-direction: column; font-size: 14px; }
.footer-text strong { color: #fff; }
.footer-text a { color: var(--accent-2); text-decoration: none; }

/* Admin */
.admin .main { padding-bottom: 60px; }
.admin-bar { background: var(--heading); color: #fff; }
.admin-bar .container { display: flex; align-items: center; justify-content: space-between; min-height: 48px; gap: 12px; }
.admin-bar a { color: #fff; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.tabs a {
    padding: 8px 18px;
    border-radius: 100px;
    background: var(--surface);
    box-shadow: var(--shadow);
    color: var(--heading);
    font-weight: 500;
    text-decoration: none;
}
.tabs a.active { background: var(--gradient); color: #fff; }
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 24px; }
.panel h2 { font-size: 20px; }
.panel h3 { font-size: 17px; }
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-weight: 500; color: var(--heading); margin-bottom: 6px; }
.form-row .help { font-size: 13px; color: #9a9a9a; margin-top: 4px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; color: var(--heading); }
.inline-form { display: inline; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
td .actions { flex-wrap: nowrap; gap: 6px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--divider); vertical-align: middle; }
th { color: var(--heading); font-weight: 700; background: #fafafa; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.thumb { width: 48px; height: 60px; object-fit: cover; border-radius: 4px; }

.result-row { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--divider); }
.result-row img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.result-name { color: var(--heading); font-weight: 500; }
.bar { height: 8px; border-radius: 4px; background: #eef1f3; margin-top: 6px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--gradient); }
.result-count { font-size: 20px; font-weight: 700; color: var(--heading); text-align: right; }
.result-count small { display: block; font-size: 12px; font-weight: 400; color: #9a9a9a; }
.stats { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.stat { background: var(--surface); box-shadow: var(--shadow); border-radius: var(--radius); padding: 16px 22px; min-width: 160px; }
.stat strong { display: block; font-size: 28px; color: var(--heading); }
.login-box { max-width: 400px; margin: 40px auto; }
code, pre { background: #f1f3f5; border-radius: 4px; padding: 2px 6px; font-size: 13px; }
pre { padding: 12px; overflow-x: auto; }

@media (max-width: 760px) {
    .header-inner { min-height: 72px; }
    .logo-iocs, .logo-se { width: 48px; height: 48px; }
    .header-right { gap: 10px; }
    .lang-switch a { padding: 3px 9px; }
    .brand-text strong { font-size: 14px; }
    .brand-text small { font-size: 12px; }
    .page-title { padding: 36px 0 28px; }
    .container { padding: 0 16px; }
    .main { padding: 28px 16px 260px; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
    .vote-bar-inner { grid-template-columns: 1fr; }
    .vote-email { flex-direction: column; }
    .vote-email input { width: 100%; }
    .bio-dialog[open] { grid-template-columns: 1fr; overflow-y: auto; }
    .bio-dialog img { max-height: 320px; }
    .dialog-body { max-height: none; overflow: visible; padding: 22px; }
    .footer-logos { gap: 8px; }
    .logo-tile { width: 44px; height: 44px; padding: 5px; }
    .logo-tile.logo-main { width: 76px; height: 76px; margin: 0 4px; }
}
@media (max-width: 420px) {
    .brand-text small { display: none; }
    .brand { gap: 10px; }
    .brand-text strong { font-size: 13px; }
    .logo-iocs, .logo-se { width: 40px; height: 40px; }
}
