:root {
    --sinine: #1f5fa8;
    --sinine-tume: #164579;
    --hall-taust: #f4f6f8;
    --hall-joon: #dde2e8;
    --roheline: #2e8b57;
    --kollane: #c98a00;
    --oranz: #d9720a;
    --punane: #c0392b;
    --tekst: #232a31;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--hall-taust);
    color: var(--tekst);
    font-size: 15px;
}

a { color: var(--sinine); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; align-items: stretch; }

.sidebar {
    width: 230px;
    flex-shrink: 0;
    background: var(--sinine-tume);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.sidebar .brand { padding: 0 20px 20px; font-weight: 700; font-size: 17px; color: #fff; }
.sidebar-nav { flex: 1; display: flex; flex-direction: column; }
.sidebar-nav a {
    padding: 10px 20px;
    color: #dce8f7;
    font-size: 12px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: .05em;
    border-left: 3px solid transparent;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; color: #fff; }
.sidebar-nav a.aktiivne { background: rgba(255,255,255,.13); color: #fff; font-weight: 600; border-left-color: #fff; }
.sidebar-user {
    padding: 16px 20px 0;
    margin-top: 12px;
    border-top: 1px solid rgba(255,255,255,.15);
    font-size: 13px;
    color: #b7cceb;
}
.sidebar-user .roll-badge { margin: 6px 0 10px; display: inline-block; }
.sidebar-logout { display: block; color: #dce8f7; margin-top: 6px; font-size: 13px; }
.sidebar-logout:hover { color: #fff; }

.main { flex: 1; min-width: 0; }

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

h1 { font-size: 19px; font-weight: 500; margin: 0 0 18px; color: #6b7785; text-transform: uppercase; letter-spacing: .02em; }
h2 { font-size: 13px; margin: 28px 0 12px; text-transform: uppercase; font-weight: 600; letter-spacing: .06em; color: #4a5560; }
h3 { font-size: 11px; margin: 0 0 8px; text-transform: uppercase; font-weight: 500; letter-spacing: .04em; color: #6b7785; }

.card {
    background: #fff;
    border: 1px solid var(--hall-joon);
    border-radius: 8px;
    padding: 18px 20px;
    margin-bottom: 18px;
}

.grid { display: grid; gap: 14px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 800px) {
    .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--hall-joon); }
th { background: #f9fafb; font-weight: 500; color: #6b7785; text-transform: uppercase; font-size: 12px; letter-spacing: .04em; }
tr:hover td { background: #fafcff; }

.btn {
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
    line-height: normal;
    background: var(--sinine);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .03em;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: var(--sinine-tume); text-decoration: none; color: #fff; }
.btn-hall { background: #6b7785; }
.btn-hall:hover { background: #55606c; }
.btn-punane { background: var(--punane); }
.btn-punane:hover { background: #9c2c1f; }
.btn-roheline { background: var(--roheline); }
.btn-roheline:hover { background: #256e46; }
.btn-small { padding: 7px 12px; font-size: 11px; }

.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    min-width: 84px;
    text-align: center;
}
.staatus-punane { background: #fbe3e0; color: var(--punane); }
.staatus-kollane { background: #fbeecb; color: var(--kollane); }
.staatus-oranz { background: #fbe4cb; color: var(--oranz); }
.staatus-roheline { background: #e1f0e6; color: var(--roheline); }
.staatus-sinine { background: #e3ecfb; color: var(--sinine); }

.roll-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    background: #eef1f4;
    color: #55606c;
}

.icon-btn {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    border-radius: 4px;
    vertical-align: middle;
}
.icon-btn:hover { background: rgba(0,0,0,.06); }
.icon-btn.icon-muuda { color: #7c8892; }
.icon-btn.icon-kustuta { color: var(--punane); }

form.inline { display: inline; }

.form-row { margin-bottom: 14px; }
.form-row label { display: block; margin-bottom: 4px; font-weight: 500; font-size: 11px; color: #6b7785; text-transform: uppercase; letter-spacing: .04em; }
.form-row input[type=text],
.form-row input[type=email],
.form-row input[type=password],
.form-row input[type=date],
.form-row input[type=number],
.form-row select,
.form-row textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--hall-joon);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}
.form-row .help { font-size: 12px; color: #7c8892; margin-top: 3px; }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.flash-ok { background: #e1f0e6; color: var(--roheline); }
.flash-viga { background: #fbe3e0; color: var(--punane); }

.breadcrumb { font-size: 13px; color: #7c8892; margin-bottom: 10px; }
.breadcrumb a { color: #4a5560; }

.login-wrap {
    max-width: 380px;
    margin: 90px auto;
    background: #fff;
    padding: 32px;
    border-radius: 10px;
    border: 1px solid var(--hall-joon);
}
.login-wrap h1 { text-align: center; }

.muted { color: #7c8892; font-size: 13px; }
.right { text-align: right; }
.mt-0 { margin-top: 0; }
.tab-nav { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--hall-joon); }
.tab-nav a {
    padding: 8px 14px;
    font-size: 14px;
    color: #55606c;
    border-bottom: 2px solid transparent;
}
.tab-nav a.active { color: var(--sinine); border-bottom-color: var(--sinine); font-weight: 600; }

details.lisa-uus { margin: 28px 0 18px; }
details.lisa-uus > summary {
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--tekst);
}
details.lisa-uus > summary::-webkit-details-marker { display: none; }
details.lisa-uus > summary::before { content: "▸"; font-size: 13px; color: #7c8892; display: inline-block; transition: transform .15s; }
details.lisa-uus[open] > summary::before { transform: rotate(90deg); }
details.lisa-uus > summary:hover { color: var(--sinine); }
details.lisa-uus .card { margin-top: 12px; }

.modal-varjund {
    position: fixed;
    inset: 0;
    background: rgba(20, 30, 40, .5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.modal-sisu {
    background: #fff;
    border-radius: 10px;
    padding: 24px;
    max-width: 520px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
