:root {
    --bg: #f4f2ee;
    --panel: #ffffff;
    --ink: #121721;
    --muted: #667085;
    --line: #e4e7ec;
    --brand: #101828;
    --brand-soft: #182230;
    --accent: #c99735;
    --danger: #b42318;
    --success: #067647;
    --radius: 8px;
    --shadow: 0 14px 42px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Segoe UI", Arial, Helvetica, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(201,151,53,.13), transparent 28rem),
        linear-gradient(180deg, #fbfaf7 0%, var(--bg) 100%);
    color: var(--ink);
    line-height: 1.5;
}
a { color: var(--brand); text-decoration: none; }
button, .button-link {
    border: 0;
    background: linear-gradient(135deg, var(--brand), var(--brand-soft));
    color: white;
    min-height: 40px;
    border-radius: var(--radius);
    padding: 0 14px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
button:hover, .button-link:hover { filter: brightness(.95); }
.primary { background: var(--brand); }
.secondary-button {
    background: #ffffff;
    color: var(--brand);
    border: 1px solid var(--line);
    box-shadow: none;
}
.secondary-button:hover {
    border-color: var(--accent);
    background: #fff7e0;
}

.app-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
}
.sidebar {
    background: linear-gradient(180deg, #0b1220 0%, #111827 100%);
    color: white;
    padding: 18px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    margin-bottom: 26px;
}
.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--accent), #f4d58d);
    color: #111827;
    display: grid;
    place-items: center;
    font-weight: 800;
}
.brand small, .profile-chip small { display: block; color: #b7c0cd; margin-top: 2px; }
.sidebar nav { display: grid; gap: 6px; }
.sidebar nav a {
    color: #e5e7eb;
    padding: 10px 12px;
    border-radius: var(--radius);
}
.sidebar nav a:hover { background: rgba(255,255,255,.1); color: #ffffff; }
.nav-form button {
    width: 100%;
    justify-content: flex-start;
    background: transparent;
    color: #e5e7eb;
    padding: 10px 12px;
    font-weight: 400;
}
.nav-form button:hover { background: rgba(255,255,255,.08); }
.main { padding: 28px; min-width: 0; }
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}
.topbar h1 { margin: 0; font-size: 26px; }
.utility-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: -6px 0 16px;
}
.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    margin: 0 0 4px;
}
.profile-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,.86);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 8px 10px;
}
.profile-chip img, .avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
}
.thumb {
    width: 88px;
    height: 56px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--line);
}

.panel, .form-card, .stat, .content-card, .course-day, .evaluation-card, .certificate-preview {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}
.panel { margin-bottom: 18px; }
.grid { display: grid; gap: 14px; }
.stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; }
.stat span { display: block; color: var(--muted); text-transform: capitalize; font-size: 13px; }
.stat strong { display: block; font-size: 25px; margin-top: 8px; color: var(--brand); }
.two-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}
.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}
.section-title h2, .section-title h3 { margin: 0; }
.list-row {
    border-top: 1px solid var(--line);
    padding: 12px 0;
    display: grid;
    gap: 4px;
}
.list-row:first-of-type { border-top: 0; }
.list-row span { color: var(--muted); font-size: 14px; }
.muted-line {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-top: 4px;
}
.badge, .colored-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 26px;
    border-radius: 999px;
    padding: 0 10px;
    background: #eef2f7;
    color: #344054;
    font-size: 12px;
    font-weight: 800;
}
.colored-badge { background: var(--badge-color); color: white; margin: 4px 4px 0 0; }
.badge-list { display: flex; flex-wrap: wrap; gap: 8px; }

.auth-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 28px;
    align-items: start;
    max-width: 980px;
}
.auth-panel h2 { font-size: 34px; margin: 0 0 10px; }
.info-box {
    display: grid;
    gap: 6px;
    background: #fff7e0;
    border: 1px solid #f4d58d;
    border-radius: var(--radius);
    padding: 14px;
    margin-top: 18px;
}
form { margin: 0; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
.field-help {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
}
.form-intro {
    margin: 0 0 10px;
    color: var(--muted);
}
.filters-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}
.mobile-card-list {
    display: none;
    gap: 10px;
}
.data-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
    display: grid;
    gap: 6px;
    background: #ffffff;
}
.data-card strong { color: var(--brand); }
.status-ok { color: var(--success); }
.status-danger { color: var(--danger); }
.status-warn { color: #a15c07; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    min-height: 40px;
    padding: 9px 10px;
    background: white;
    color: var(--ink);
}
input:focus, select:focus, textarea:focus {
    outline: 3px solid rgba(201,151,53,.22);
    border-color: var(--accent);
}
textarea { min-height: 90px; resize: vertical; }
.form-card, .stack-form { display: grid; gap: 12px; }
.compact-form, .inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}
.compact-form > *, .inline-form > * { flex: 1 1 150px; }
.inline-form button, .compact-form button { flex: 0 0 auto; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.check {
    display: flex;
    align-items: center;
    gap: 8px;
}
.check input { width: auto; min-height: auto; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td {
    text-align: left;
    border-bottom: 1px solid var(--line);
    padding: 10px;
    vertical-align: middle;
}
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.quick-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.quick-tabs a {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 8px 10px;
    color: var(--ink);
}
.quick-tabs a:hover {
    border-color: var(--accent);
    background: #fff7e0;
}
.alert {
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 14px;
    border: 1px solid var(--line);
    background: white;
}
.alert.success { border-color: #abefc6; background: #ecfdf3; color: var(--success); }
.alert.danger { border-color: #fecdca; background: #fef3f2; color: var(--danger); }

.content-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.course-day { margin-bottom: 14px; }
.post {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
    border-top: 1px solid var(--line);
    padding: 14px 0;
}
.post p { margin: 6px 0; }
.post:first-of-type { border-top: 0; }
.post span { color: var(--muted); display: block; font-size: 13px; }
pre {
    white-space: pre-wrap;
    background: #101828;
    color: #e5e7eb;
    border-radius: var(--radius);
    padding: 14px;
    overflow-x: auto;
}
.choice { display: block; margin: 8px 0; color: var(--ink); font-weight: 400; }
.choice input { width: auto; min-height: auto; }
.certificate-preview { display: grid; gap: 6px; margin-bottom: 10px; }
.certificate-admin-card {
    border-top: 1px solid var(--line);
    padding: 12px 0;
    display: grid;
    gap: 8px;
}
.certificate-admin-card:first-of-type { border-top: 0; }
.action-stack {
    display: grid;
    gap: 8px;
    min-width: 180px;
}
.criteria-list {
    display: grid;
    gap: 4px;
    color: var(--muted);
    font-size: 13px;
}
.certificate-public { text-align: center; max-width: 760px; margin: 0 auto; }
.certificate-photo {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: 50%;
    border: 4px solid #ecfeff;
}

@media (max-width: 980px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: relative;
        height: auto;
        padding-bottom: 12px;
    }
    .sidebar nav {
        display: flex;
        overflow-x: auto;
        gap: 8px;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }
    .sidebar nav a, .nav-form button {
        white-space: nowrap;
        min-height: 44px;
    }
    .nav-form { flex: 0 0 auto; }
    .quick-tabs {
        display: flex;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
    }
    .stats-grid, .two-columns, .auth-panel, .content-grid { grid-template-columns: 1fr; }
    .filters-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .topbar { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 560px) {
    .main { padding: 14px; }
    .sidebar { padding: 14px; }
    .brand { margin-bottom: 14px; }
    .topbar h1 { font-size: 22px; }
    .auth-panel h2 { font-size: 26px; }
    .form-grid { grid-template-columns: 1fr; }
    .compact-form, .inline-form { display: grid; }
    .filters-bar { grid-template-columns: 1fr; }
    .table-wrap.mobile-cards table { display: none; }
    .table-wrap.mobile-cards { overflow: visible; }
    .mobile-card-list { display: grid; }
    table { min-width: 560px; }
    button, .button-link, input, select { min-height: 44px; }
    .panel, .form-card, .stat, .content-card, .course-day, .evaluation-card, .certificate-preview { padding: 14px; }
    .section-title { align-items: flex-start; flex-direction: column; }
    .post { grid-template-columns: 36px minmax(0, 1fr); }
}
