:root {
    --ink: #17201d;
    --muted: #68726e;
    --line: #dfe5e2;
    --surface: #ffffff;
    --canvas: #f4f6f5;
    --green: #135f4a;
    --green-dark: #0c4637;
    --lime: #c8e66b;
    --danger: #b42318;
    --shadow: 0 18px 45px rgba(20, 44, 36, .08);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--canvas); }
a { color: inherit; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); font-weight: 750; text-decoration: none; }
.brand img { display: block; width: 112px; height: 36px; object-fit: contain; object-position: left center; }
.brand span { padding-left: 12px; border-left: 1px solid rgba(23, 32, 29, .18); }
.brand-light { color: #fff; }
.brand-light span { border-left-color: rgba(255,255,255,.25); }

.login-page { background: var(--green-dark); }
.login-shell { display: grid; grid-template-columns: minmax(360px, .9fr) minmax(480px, 1.1fr); min-height: 100vh; }
.login-intro { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: clamp(40px, 6vw, 88px); color: #fff; background: linear-gradient(145deg, #0a4032, #17684f); }
.login-intro::after { content: ""; position: absolute; right: -160px; bottom: -190px; width: 440px; height: 440px; border: 1px solid rgba(200,230,107,.35); border-radius: 50%; box-shadow: 0 0 0 68px rgba(200,230,107,.06), 0 0 0 140px rgba(200,230,107,.04); }
.login-intro > * { position: relative; z-index: 1; }
.login-intro h1 { max-width: 620px; margin: 16px 0 20px; font-size: clamp(2.3rem, 4vw, 4.4rem); line-height: .98; letter-spacing: -.055em; }
.login-intro p { max-width: 560px; color: rgba(255,255,255,.74); font-size: 1.05rem; line-height: 1.7; }
.eyebrow { display: block; color: var(--lime); font-size: .75rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.eyebrow-dark { color: var(--green); }
.security-note { margin: 0; font-size: .85rem !important; }
.login-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; background: #f7f8f7; }
.login-card { width: min(100%, 480px); padding: clamp(32px, 5vw, 56px); border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.login-heading { margin-bottom: 34px; }
.login-heading h2 { margin: 10px 0 8px; font-size: 2rem; letter-spacing: -.035em; }
.login-heading p, .page-header p { margin: 0; color: var(--muted); line-height: 1.6; }
.support-text { margin: 22px 0 0; color: var(--muted); font-size: .82rem; }

.form-stack { display: grid; gap: 20px; }
.field { display: grid; gap: 8px; }
.field label { font-size: .88rem; font-weight: 700; }
.field small, .check-field small { color: var(--muted); font-size: .78rem; line-height: 1.45; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"] { width: 100%; min-height: 46px; padding: 0 14px; border: 1px solid #cfd7d3; border-radius: 9px; color: var(--ink); background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(19,95,74,.12); }
.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; padding: 0 18px; border: 1px solid transparent; border-radius: 9px; font-weight: 750; text-decoration: none; cursor: pointer; transition: transform .15s, background .15s; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--green); }
.button-primary:hover { background: var(--green-dark); }
.button-secondary { border-color: var(--line); color: var(--ink); background: #fff; }
.button-full { width: 100%; margin-top: 8px; }

.app-shell { display: grid; grid-template-columns: 258px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; height: 100vh; flex-direction: column; padding: 28px 20px 20px; color: #fff; background: #103f33; }
.brand-sidebar { margin: 0 12px 44px; color: #fff; }
.brand-sidebar span { border-left-color: rgba(255,255,255,.24); }
.main-nav { display: grid; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 9px; color: rgba(255,255,255,.72); font-size: .9rem; font-weight: 650; text-decoration: none; }
.nav-item.active { color: #fff; background: rgba(255,255,255,.1); }
.nav-icon { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 7px; color: #17382f; background: var(--lime); font-size: .73rem; font-weight: 900; }
.sidebar-footer { display: grid; gap: 16px; margin-top: auto; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.12); }
.current-user, .user-cell { display: flex; min-width: 0; align-items: center; gap: 11px; }
.current-user > span:last-child, .user-cell > span:last-child { min-width: 0; }
.current-user strong, .current-user small, .user-cell strong, .user-cell small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.current-user strong { font-size: .82rem; }
.current-user small { margin-top: 3px; color: rgba(255,255,255,.58); font-size: .72rem; }
.avatar { display: grid; flex: 0 0 auto; width: 36px; height: 36px; place-items: center; border-radius: 10px; color: #17382f; background: var(--lime); font-size: .8rem; font-weight: 900; }
.logout-button { width: 100%; padding: 8px; border: 0; color: rgba(255,255,255,.66); background: transparent; text-align: left; cursor: pointer; }
.logout-button:hover { color: #fff; }
.main-content { min-width: 0; }
.mobile-header { display: none; }
.content-wrap { width: min(100%, 1320px); margin: 0 auto; padding: 58px clamp(28px, 5vw, 72px); }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-header h1 { margin: 7px 0 8px; font-size: clamp(2rem, 3vw, 2.8rem); letter-spacing: -.045em; }
.compact-header { align-items: flex-start; }
.back-link { display: inline-block; margin-bottom: 20px; color: var(--green); font-size: .86rem; font-weight: 700; text-decoration: none; }
.card { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 10px 30px rgba(20,44,36,.04); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.search-form { display: flex; width: min(100%, 620px); align-items: center; gap: 10px; }
.search-form input { max-width: 380px; }
.text-link, .danger-link { border: 0; color: var(--green); background: none; font-size: .85rem; font-weight: 750; text-decoration: none; cursor: pointer; }
.danger-link { color: var(--danger); }
.result-count { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 16px 20px; border-bottom: 1px solid #edf0ee; text-align: left; vertical-align: middle; }
th { color: var(--muted); background: #fafbfa; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
td { font-size: .86rem; }
tbody tr:hover { background: #fbfcfb; }
.user-cell { min-width: 240px; }
.user-cell strong { font-size: .88rem; }
.user-cell small { margin-top: 4px; color: var(--muted); font-size: .78rem; }
.avatar-table { width: 38px; height: 38px; background: #e4ece8; }
.badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; color: #52605b; background: #edf1ef; font-size: .72rem; font-weight: 750; }
.badge-admin { color: var(--green-dark); background: #dcece5; }
.table-actions { display: flex; justify-content: flex-end; gap: 14px; }
.table-actions form { margin: 0; }
.empty-state { padding: 52px; color: var(--muted); text-align: center; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 16px; padding: 17px 20px; color: var(--muted); font-size: .8rem; }
.pagination a { color: var(--green); font-weight: 750; text-decoration: none; }
.page-disabled { opacity: .45; }
.form-card { max-width: 840px; padding: 30px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.field-wide { grid-column: 1 / -1; }
.check-field { display: flex; align-items: flex-start; gap: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.check-field input { width: 18px; height: 18px; accent-color: var(--green); }
.check-field strong, .check-field small { display: block; }
.check-field small { margin-top: 4px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); }
.alert { margin-bottom: 20px; padding: 13px 15px; border: 1px solid; border-radius: 9px; font-size: .86rem; line-height: 1.5; }
.alert ul { margin: 8px 0 0; padding-left: 20px; }
.alert-success { border-color: #a8d2bf; color: #175940; background: #eaf6f0; }
.alert-error { border-color: #efb1ad; color: #8b211a; background: #fff0ef; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

@media (max-width: 900px) {
    .login-shell { grid-template-columns: 1fr; }
    .login-intro { min-height: 360px; padding: 42px 30px; }
    .login-intro h1 { font-size: 2.6rem; }
    .security-note { display: none; }
    .login-panel { padding: 30px 20px 54px; }
    .app-shell { display: block; }
    .sidebar { display: none; }
    .mobile-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--line); background: #fff; }
    .content-wrap { padding: 36px 24px; }
}

@media (max-width: 620px) {
    .login-intro { min-height: 300px; }
    .login-intro h1 { font-size: 2.15rem; }
    .page-header, .toolbar { align-items: stretch; flex-direction: column; }
    .page-header .button { width: 100%; }
    .search-form { flex-wrap: wrap; }
    .search-form input { max-width: none; flex: 1 1 100%; }
    .result-count { align-self: flex-end; }
    .form-grid { grid-template-columns: 1fr; }
    .field-wide { grid-column: auto; }
    .form-card { padding: 20px; }
    .form-actions { flex-direction: column-reverse; }
    .table-actions { justify-content: flex-start; }
    th, td { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
