:root {
    --green: #1f7a44;
    --green-dark: #155c33;
    --green-light: #e8f5ee;
    --amber: #d9822b;
    --red: #c0392b;
    --blue: #2c6cb0;
    --ink: #1f2933;
    --muted: #6b7280;
    --line: #e5e7eb;
    --bg: #f4f6f8;
    --card: #ffffff;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-lg: 0 10px 30px rgba(0,0,0,.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.5;
}
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- AUTH ---------- */
.auth-body { background: linear-gradient(135deg, #0f3d24, #1f7a44); }
.auth-wrap {
    display: grid; grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}
.auth-brand { display: flex; align-items: center; justify-content: center; padding: 48px; color: #fff; }
.auth-brand-inner { max-width: 420px; }
.auth-brand h1 { font-size: 26px; margin: 18px 0 14px; line-height: 1.3; }
.auth-brand p { opacity: .9; font-size: 15px; }
.brand-logo { font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.brand-points { list-style: none; margin-top: 24px; }
.brand-points li { padding: 8px 0 8px 28px; position: relative; opacity: .95; }
.brand-points li::before { content: '✓'; position: absolute; left: 0; font-weight: 700; }
.auth-form-area { background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 40px; }
.auth-card { background: var(--card); padding: 36px; border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 440px; }
.auth-card h2 { font-size: 22px; margin-bottom: 6px; }
.auth-card .sub { color: var(--muted); margin-bottom: 24px; }
.auth-foot { margin-top: 20px; text-align: center; color: var(--muted); }
.auth-demo-hint { margin-bottom: 20px; }
.auth-demo-hint .hint { margin: 6px 0 10px; color: inherit; opacity: .92; }
.auth-demo-hint code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: rgba(255,255,255,.65); padding: 2px 6px; border-radius: 4px; }

@media (max-width: 860px) {
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
}

/* ---------- FORM ---------- */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.req { color: var(--red); }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=datetime-local], input[type=tel], select, textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--line);
    border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--green);
    box-shadow: 0 0 0 3px var(--green-light);
}
textarea { resize: vertical; min-height: 80px; }
.field-error { color: var(--red); font-size: 12px; margin-top: 4px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ---------- BUTTONS ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 18px; border: none; border-radius: 8px; font-size: 14px; font-weight: 600;
    cursor: pointer; font-family: inherit; transition: background .15s, opacity .15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-block { width: 100%; }
.btn-outline { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn-outline:hover { background: var(--bg); }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.link-btn { background: none; border: none; color: var(--green); cursor: pointer; font-size: 13px; padding: 0; }

/* ---------- ALERTS ---------- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-size: 14px; }
.alert-success { background: var(--green-light); color: var(--green-dark); border: 1px solid #b6e0c6; }
.alert-error { background: #fdecea; color: var(--red); border: 1px solid #f5c6c0; }
.alert-warn { background: #fef5e7; color: var(--amber); border: 1px solid #f6d9a8; }
.alert ul { margin-left: 18px; }

/* ---------- LAYOUT ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 248px; background: #102a1c; color: #cbd5cf; flex-shrink: 0;
    display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 40;
    overflow-y: auto;
}
.sidebar-brand { padding: 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand .brand-logo { color: #fff; }
.sidebar-nav { padding: 12px 0; }
.nav-group { padding: 14px 20px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: #6f8478; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 20px; color: #cbd5cf; font-size: 14px; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--green); color: #fff; }
.nav-ico { width: 18px; text-align: center; opacity: .9; }

.main { flex: 1; margin-left: 248px; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    height: 60px; background: #fff; border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: 16px; padding: 0 24px; position: sticky; top: 0; z-index: 30;
}
.topbar-title { font-size: 18px; font-weight: 700; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.hamburger { display: none; background: none; border: none; font-size: 22px; cursor: pointer; }

.notif { position: relative; }
.notif-bell { background: none; border: none; font-size: 20px; cursor: pointer; position: relative; }
.notif-badge { position: absolute; top: -6px; right: -8px; background: var(--red); color: #fff;
    font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.notif-drop { display: none; position: absolute; right: 0; top: 38px; width: 320px; background: #fff;
    border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); overflow: hidden; }
.notif-drop.show { display: block; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--ink); }
.notif-item:hover { background: var(--bg); text-decoration: none; }
.notif-item strong { display: block; font-size: 13px; }
.notif-item span { display: block; color: var(--muted); font-size: 12px; }
.notif-item small { color: var(--muted); font-size: 11px; }
.notif-empty { padding: 24px; text-align: center; color: var(--muted); }

.user-menu { display: flex; align-items: center; gap: 12px; }
.user-info { text-align: right; line-height: 1.2; }
.user-info strong { display: block; font-size: 13px; }
.user-info small { color: var(--muted); font-size: 12px; }
.btn-logout { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; width: 36px; height: 36px; cursor: pointer; font-size: 16px; }

.content { padding: 24px; flex: 1; }

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s; }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .hamburger { display: block; }
    .form-row { grid-template-columns: 1fr; }
}

/* ---------- CARDS / PAGE ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-head h1 { font-size: 22px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card + .card { margin-top: 18px; }
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 24px; font-weight: 800; margin-top: 4px; }
.stat .value.green { color: var(--green); }
.stat .value.red { color: var(--red); }
.stat .value.blue { color: var(--blue); }

/* ---------- TABLE ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
table.data th { background: #fafbfc; font-weight: 700; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .3px; white-space: nowrap; }
table.data tbody tr:hover { background: #fafbfc; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-empty { text-align: center; padding: 36px; color: var(--muted); }

/* ---------- BADGES ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-gray { background: #eceff1; color: #546e7a; }
.badge-green { background: var(--green-light); color: var(--green-dark); }
.badge-amber { background: #fef5e7; color: var(--amber); }
.badge-red { background: #fdecea; color: var(--red); }
.badge-blue { background: #e7f0fa; color: var(--blue); }

/* ---------- MODAL ---------- */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(15,23,30,.5); z-index: 60; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal-overlay.show { display: flex; }
.modal { background: #fff; border-radius: var(--radius); width: 100%; max-width: 560px; box-shadow: var(--shadow-lg); }
.modal-head { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 20px; }
.modal-foot { padding: 16px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--muted); }

/* ---------- ERROR PAGES ---------- */
.error-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.error-card { text-align: center; background: #fff; padding: 48px; border-radius: var(--radius); box-shadow: var(--shadow-lg); max-width: 440px; }
.error-code { font-size: 72px; font-weight: 800; color: var(--green); }
.error-card h1 { font-size: 22px; margin: 8px 0; }
.error-card p { color: var(--muted); margin-bottom: 24px; }

/* ---------- UTIL ---------- */
.mt-0{margin-top:0}.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mb-2{margin-bottom:16px}
.flex{display:flex}.flex-between{display:flex;justify-content:space-between;align-items:center}
.gap-1{gap:8px}.gap-2{gap:16px}
.text-muted{color:var(--muted)}.text-right{text-align:right}.text-center{text-align:center}
.w-100{width:100%}
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.search-input { max-width: 280px; }
.pagination { display: flex; gap: 6px; justify-content: flex-end; margin-top: 16px; align-items: center; }
.pagination button { padding: 6px 12px; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; }
.pagination button:disabled { opacity: .5; cursor: default; }
