:root {
    --bg: #f6f7f9;
    --panel: #ffffff;
    --ink: #18212f;
    --muted: #657184;
    --line: #dfe4ea;
    --brand: #0f77b7;
    --brand-dark: #063d63;
    --accent: #1fb8a6;
    --danger: #b42318;
    --shadow: 0 18px 55px rgba(24, 33, 47, .09);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--ink);
    background: var(--bg);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    line-height: 1.55;
}

a { color: inherit; text-decoration: none; }

main { min-height: calc(100vh - 70px); }

.topbar {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 clamp(18px, 4vw, 52px);
    background: rgba(255,255,255,.92);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(16px);
}

.brand, .topnav { display: flex; align-items: center; gap: 12px; }

.brand { font-weight: 800; }

.brand-mark {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 7px;
    color: white;
    background: var(--brand-dark);
    font-size: 13px;
}

.topnav a {
    padding: 7px 10px;
    border-radius: 7px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.topnav a.active, .topnav a:hover { color: var(--ink); background: #eef6fb; }

.login-shell {
    min-height: calc(100vh - 70px);
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr);
}

.login-visual {
    min-height: 520px;
    position: relative;
    overflow: hidden;
    background: #dcecf5;
}

.login-visual img {
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
    object-fit: cover;
}

.visual-fallback {
    display: none;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    color: var(--brand-dark);
    font-size: clamp(32px, 7vw, 80px);
    font-weight: 800;
}

.login-visual.no-image .visual-fallback { display: flex; }

.login-panel {
    display: grid;
    place-items: center;
    padding: clamp(28px, 6vw, 70px);
    background: white;
}

.login-card { width: min(100%, 420px); }

.eyebrow {
    margin: 0 0 10px;
    color: var(--brand);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

h1, h2, h3, h4, p { margin-top: 0; }

.login-card h1, .page-head h1, .reader-title h1 {
    margin-bottom: 10px;
    font-size: clamp(34px, 5vw, 58px);
    line-height: 1.02;
}

.muted, .page-head p, .reader-title p { color: var(--muted); }

form { display: grid; gap: 14px; }

label { display: grid; gap: 7px; color: #364154; font-size: 14px; font-weight: 700; }

input, select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 11px 12px;
    background: white;
    color: var(--ink);
    font: inherit;
}

button {
    border: 0;
    border-radius: 7px;
    padding: 12px 15px;
    background: var(--brand-dark);
    color: white;
    font-weight: 800;
    cursor: pointer;
}

button:hover { background: var(--brand); }

.danger { background: var(--danger); }

.alert {
    margin: 18px 0;
    padding: 12px;
    border-radius: 7px;
    color: #7a271a;
    background: #fff0ec;
}

.page-head, .reader {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: clamp(40px, 7vw, 82px) 0;
}

.resource-grid {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto 80px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.resource-card {
    min-height: 220px;
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.resource-card span { color: var(--accent); font-weight: 900; }
.resource-card h2 { margin: 26px 0 10px; font-size: 26px; line-height: 1.18; }
.resource-card p { color: var(--muted); margin-bottom: 0; }
.muted-card { opacity: .58; pointer-events: none; }

.back-link {
    display: inline-flex;
    margin-bottom: 22px;
    color: var(--brand);
    font-weight: 800;
}

.reader { max-width: 980px; }

.reader-title {
    padding-bottom: 28px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 22px;
}

.guideline-section {
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
}

.guideline-section summary {
    cursor: pointer;
    padding: 19px 22px;
    font-weight: 900;
    color: var(--brand-dark);
}

.guideline-body {
    padding: 0 22px 24px;
}

.guideline-body h3 { margin: 26px 0 10px; font-size: 21px; }
.guideline-body h4 { margin: 22px 0 8px; font-size: 17px; }
.guideline-body p, .guideline-body li { color: #2e3746; }
.guideline-body blockquote {
    margin: 18px 0;
    padding: 14px 16px;
    border-left: 4px solid var(--accent);
    background: #eefaf8;
}

.file-row {
    padding: 12px;
    border: 1px dashed var(--line);
    border-radius: 7px;
    color: var(--muted);
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 680px;
}

th, td {
    padding: 12px 13px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    font-size: 14px;
}

th { background: #f2f7fa; color: var(--brand-dark); }
tr:last-child td { border-bottom: 0; }
.guideline-table { margin: 18px 0; }

.admin-wrap {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    width: min(1440px, calc(100% - 28px));
    margin: 24px auto 70px;
    gap: 22px;
}

.admin-side {
    align-self: start;
    position: sticky;
    top: 94px;
    display: grid;
    gap: 8px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
}

.admin-side h1 { font-size: 22px; }
.admin-side a { padding: 10px 12px; border-radius: 7px; color: var(--muted); font-weight: 800; }
.admin-side a.active, .admin-side a:hover { color: var(--brand-dark); background: #eef6fb; }

.admin-main {
    min-width: 0;
    display: grid;
    gap: 20px;
}

.admin-title, .admin-form, .metric-grid > div, .two-col > section {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    padding: 20px;
}

.admin-title p { color: var(--muted); margin-bottom: 0; }

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.metric-grid span { display: block; color: var(--muted); font-weight: 800; font-size: 13px; }
.metric-grid strong { display: block; margin-top: 6px; font-size: 34px; }

.two-col {
    display: grid;
    grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
    gap: 18px;
}

.grid-form {
    margin-top: 16px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: end;
}

.grid-form button { min-height: 45px; }

.actions {
    display: flex;
    gap: 8px;
    min-width: 150px;
}

.actions form { display: block; }

.compact-table table { min-width: 760px; }

@media (max-width: 900px) {
    .topbar { height: auto; min-height: 64px; gap: 10px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
    .login-shell { grid-template-columns: 1fr; }
    .login-visual { min-height: 42vh; }
    .login-panel { place-items: start; }
    .resource-grid, .metric-grid, .two-col, .admin-wrap, .grid-form { grid-template-columns: 1fr; }
    .admin-side { position: static; }
}

@media (max-width: 560px) {
    .brand span:last-child { display: none; }
    .topnav { gap: 4px; }
    .topnav a { padding: 6px 7px; }
    .login-card h1, .page-head h1, .reader-title h1 { font-size: 34px; }
    .resource-card { min-height: 180px; }
    .guideline-section summary, .guideline-body { padding-left: 15px; padding-right: 15px; }
    th, td { padding: 10px; }
}
