*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --green:       #2d6a4f;
    --green-light: #52b788;
    --green-pale:  #d8f3dc;
    --amber:       #e9c46a;
    --red:         #e63946;
    --gray-dark:   #1b1b1b;
    --gray:        #555;
    --gray-light:  #f4f4f4;
    --white:       #ffffff;
    --radius:      10px;
    --shadow:      0 2px 12px rgba(0,0,0,0.08);
    --font:        'Segoe UI', system-ui, sans-serif;
}

body {
    font-family: var(--font);
    background: var(--gray-light);
    color: var(--gray-dark);
    min-height: 100vh;
}

/* ── Auth pages ── */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 40px 36px;
    width: 100%;
    max-width: 420px;
}

.auth-card .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
}

.auth-card .logo span {
    font-size: 22px;
    font-weight: 700;
    color: var(--green);
}

.auth-card h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 6px;
}

.auth-card p.sub {
    color: var(--gray);
    font-size: 14px;
    margin-bottom: 24px;
}

/* ── Forms ── */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--gray);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: var(--font);
    background: var(--white);
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--green-light);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    text-decoration: none;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary  { background: var(--green); color: var(--white); width: 100%; padding: 12px; }
.btn-primary:hover { opacity: 0.9; }
.btn-sm       { padding: 6px 14px; font-size: 13px; }
.btn-edit     { background: var(--amber); color: var(--gray-dark); }
.btn-delete   { background: var(--red); color: var(--white); }
.btn-outline  { background: transparent; border: 1.5px solid var(--green); color: var(--green); }
.btn-outline:hover { background: var(--green-pale); }
.btn-green    { background: var(--green); color: var(--white); }

/* ── Alerts ── */
.alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}
.alert.show { display: block; }
.alert-error   { background: #ffe0e0; color: #b00020; }
.alert-success { background: var(--green-pale); color: var(--green); }

/* ── App shell ── */
.app-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    background: var(--green);
    color: var(--white);
    display: flex;
    flex-direction: column;
    padding: 28px 0;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 24px 28px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.sidebar .brand span {
    font-size: 18px;
    font-weight: 700;
}

.sidebar nav {
    padding: 20px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    background: rgba(255,255,255,0.15);
    color: var(--white);
}

.sidebar .user-info {
    padding: 16px 24px;
    border-top: 1px solid rgba(255,255,255,0.15);
    font-size: 13px;
}

.sidebar .user-info .name { font-weight: 600; }
.sidebar .user-info .role { opacity: 0.7; text-transform: capitalize; margin-bottom: 12px; }

.sidebar .user-info button {
    background: rgba(255,255,255,0.15);
    border: none;
    color: var(--white);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    width: 100%;
    text-align: left;
}
.sidebar .user-info button:hover { background: rgba(255,255,255,0.25); }

/* ── Main content ── */
.main {
    padding: 32px;
    overflow-y: auto;
}

.page-header {
    margin-bottom: 28px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 700;
}

.page-header p {
    color: var(--gray);
    font-size: 14px;
    margin-top: 4px;
}

/* ── Stat cards ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
}

.stat-card .value {
    font-size: 32px;
    font-weight: 700;
    color: var(--green);
}

.stat-card .label {
    font-size: 13px;
    color: var(--gray);
    margin-top: 4px;
}

/* ── Cards ── */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
}

.card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

/* ── Weather widget ── */
.weather-card {
    background: linear-gradient(135deg, var(--green) 0%, var(--green-light) 100%);
    color: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.weather-card .city { font-size: 13px; opacity: 0.85; }
.weather-card .temp { font-size: 48px; font-weight: 700; line-height: 1; margin: 8px 0; }
.weather-card .desc { font-size: 14px; opacity: 0.9; text-transform: capitalize; }
.weather-card .meta { display: flex; gap: 20px; margin-top: 16px; font-size: 13px; opacity: 0.85; }

.insight-box {
    background: var(--green-pale);
    border-left: 4px solid var(--green);
    border-radius: 0 8px 8px 0;
    padding: 14px 16px;
    font-size: 14px;
    color: var(--green);
    margin-bottom: 24px;
    line-height: 1.6;
}

/* ── Table ── */
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead th {
    background: var(--gray-light);
    text-align: left;
    padding: 10px 14px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray);
}

tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--gray-light); }

.actions { display: flex; gap: 6px; }

/* ── Modal ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-overlay.open { display: flex; }

.modal {
    background: var(--white);
    border-radius: var(--radius);
    padding: 32px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.modal h3 { font-size: 18px; margin-bottom: 20px; }

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ── Badge ── */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: var(--green-pale);
    color: var(--green);
}

/* ── Misc ── */
.link { color: var(--green); text-decoration: none; font-size: 14px; }
.link:hover { text-decoration: underline; }
.text-center { text-align: center; }
.mt-16 { margin-top: 16px; }
.empty { color: var(--gray); font-size: 14px; padding: 20px 0; text-align: center; }

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

/* ── Responsive ── */
@media (max-width: 700px) {
    .app-layout { grid-template-columns: 1fr; }
    .sidebar { height: auto; position: static; flex-direction: row; flex-wrap: wrap; padding: 16px; }
    .sidebar nav { flex-direction: row; padding: 0; }
    .main { padding: 16px; }
    .form-row { grid-template-columns: 1fr; }
}