:root {
    --color-primary: #0b3d59;
    --color-primary-light: #135a82;
    --color-accent: #d4a017;
    --color-success: #1e7e34;
    --color-warning: #b8860b;
    --color-danger: #b02a2a;
    --color-secondary: #6c757d;
    --color-bg: #f4f6f8;
    --color-card: #ffffff;
    --color-border: #dfe3e8;
    --color-text: #1f2937;
    --radius: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
}

a { color: var(--color-primary-light); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ---------- Auth pages ---------- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary) 0%, #071f2e 100%);
    padding: 16px;
}
.auth-card {
    background: var(--color-card);
    border-radius: var(--radius);
    padding: 36px 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0,0,0,.25);
    text-align: center;
}
.auth-card img.logo { height: 64px; margin-bottom: 12px; }
.auth-card h1 { font-size: 1.3rem; margin: 0 0 24px; color: var(--color-primary); }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; text-align: left; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .92rem; }
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: #fff;
}
.form-control:focus { outline: none; border-color: var(--color-primary-light); box-shadow: 0 0 0 3px rgba(19,90,130,.15); }
textarea.form-control { resize: vertical; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 200px; }

.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: var(--radius);
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-light); }
.btn-success { background: var(--color-success); color: #fff; }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-secondary { background: var(--color-secondary); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--color-border); color: var(--color-text); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: .85rem; }

.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: .92rem; }
.alert-success { background: #e6f4ea; color: #1e7e34; border: 1px solid #b8e2c2; }
.alert-danger { background: #fbe9e9; color: #b02a2a; border: 1px solid #f3c2c2; }
.alert-info { background: #e8f1f8; color: var(--color-primary); border: 1px solid #c3dced; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 230px;
    background: var(--color-primary);
    color: #fff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}
.sidebar .brand { padding: 20px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,.15); }
.sidebar .brand img { height: 34px; }
.sidebar .brand span { font-weight: 700; font-size: .95rem; }
.sidebar nav { flex: 1; padding: 12px 0; }
.sidebar nav a {
    display: block;
    padding: 12px 20px;
    color: rgba(255,255,255,.85);
    text-decoration: none;
    font-size: .92rem;
    border-left: 3px solid transparent;
}
.sidebar nav a:hover, .sidebar nav a.active { background: rgba(255,255,255,.08); border-left-color: var(--color-accent); color: #fff; }
.sidebar .user-box { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.15); font-size: .85rem; }
.sidebar .user-box .role { color: var(--color-accent); font-weight: 600; text-transform: uppercase; font-size: .7rem; }

.main-content { flex: 1; min-width: 0; }
.topbar {
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar h1 { font-size: 1.15rem; margin: 0; }
.page-body { padding: 24px; }

.sound-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: .85rem;
}
.sound-toggle.muted { color: var(--color-secondary); }
.sound-toggle.on { color: var(--color-success); border-color: #b8e2c2; }

/* ---------- Cards / tables ---------- */
.card { background: var(--color-card); border-radius: var(--radius); padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 20px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.06); border-left: 4px solid var(--color-primary); }
.stat-card .value { font-size: 1.8rem; font-weight: 700; color: var(--color-primary); }
.stat-card .label { color: var(--color-secondary); font-size: .85rem; }

table { width: 100%; border-collapse: collapse; background: #fff; }
table th, table td { padding: 10px 12px; border-bottom: 1px solid var(--color-border); text-align: left; font-size: .9rem; }
table th { background: #f0f3f6; font-weight: 600; color: var(--color-secondary); text-transform: uppercase; font-size: .75rem; letter-spacing: .03em; }
table tbody tr:hover { background: #f8fafb; }
.table-responsive { overflow-x: auto; border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,.06); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: .72rem; font-weight: 700; text-transform: uppercase; }
.badge-warning { background: #fff3cd; color: #8a6500; }
.badge-success { background: #d4edda; color: #1e7e34; }
.badge-secondary { background: #e2e3e5; color: #495057; }
.badge-danger { background: #f8d7da; color: #b02a2a; }

.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .search-input { flex: 1; min-width: 220px; }

.notif-banner {
    background: #fff8e1;
    border: 1px solid #ffe08a;
    color: #6b5200;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.empty-state { text-align: center; padding: 40px 20px; color: var(--color-secondary); }

@media (max-width: 860px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; flex-direction: row; overflow-x: auto; }
    .sidebar .brand { display: none; }
    .sidebar nav { display: flex; padding: 0; }
    .sidebar nav a { border-left: none; border-bottom: 3px solid transparent; white-space: nowrap; padding: 14px 16px; }
    .sidebar nav a.active { border-bottom-color: var(--color-accent); }
    .sidebar .user-box { display: none; }
    .page-body { padding: 16px; }
    .form-row { flex-direction: column; gap: 0; }
}

@media print {
    .no-print { display: none !important; }
}
