:root {
    --brand: #0057B8;
    --brand-hover: #00468f;
    --brand-bg: #eaf2fc;

    --surface-0: #f6f7f9;
    --surface-1: #eef0f3;
    --surface-2: #ffffff;

    --text-primary: #14181f;
    --text-secondary: #5c6470;
    --text-muted: #9aa1ac;

    --border: #e2e5ea;
    --border-strong: #cdd2da;

    --success: #1a7a3c;
    --success-bg: #e7f6ec;
    --warning: #92600a;
    --warning-bg: #fdf3df;
    --danger: #b3261e;
    --danger-bg: #fbeaea;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;

    --shadow-sm: 0 1px 2px rgba(20, 24, 31, 0.05);
    --shadow: 0 1px 3px rgba(20, 24, 31, 0.06), 0 8px 24px -12px rgba(20, 24, 31, 0.10);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--surface-0);
    color: var(--text-primary);
    font-size: 14.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

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

.app-shell { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 224px;
    flex-shrink: 0;
    background: var(--surface-2);
    border-right: 1px solid var(--border);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar .brand {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.01em;
    padding: 0 10px 4px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar .brand::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 3px;
    background: var(--brand);
    flex-shrink: 0;
}

.sidebar .company {
    font-size: 12.5px;
    color: var(--text-muted);
    padding: 0 10px 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}

.sidebar nav { display: flex; flex-direction: column; gap: 2px; }

.sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 500;
    transition: background 0.12s ease, color 0.12s ease;
}

.sidebar a:hover { background: var(--surface-1); text-decoration: none; color: var(--text-primary); }

.sidebar a.active {
    background: var(--brand-bg);
    color: var(--brand);
    font-weight: 600;
}

.sidebar .logout-row {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* Main */
.main { flex: 1; padding: 2.5rem 3rem; max-width: 960px; }

.main h1, .page-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0 0 1.5rem;
}

/* Metrics */
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 1.75rem; }

.metric-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow-sm);
}

.metric-card .label {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin: 0 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
}
.metric-card .value { font-size: 26px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }

/* Cards */
.card {
    background: var(--surface-2);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card h2 {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 1.25rem;
    letter-spacing: -0.005em;
}

/* Forms */
label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.field { margin-bottom: 1.1rem; }

input, select, textarea, button {
    font-family: inherit;
    font-size: 14px;
}

input[type=text], input[type=password], input[type=tel], input[type=number],
input[type=date], input[type=datetime-local], select, textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text-primary);
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-bg);
}

textarea { resize: vertical; min-height: 90px; }

.char-count { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Inline field groups (e.g. select + phone input side by side) */
.field-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.field-row > * { flex: 1; min-width: 0; }

/* Buttons */
button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 600;
    transition: background 0.12s ease, border-color 0.12s ease, transform 0.05s ease;
}

button:hover, .btn:hover { background: var(--surface-1); }
button:active, .btn:active { transform: translateY(1px); }

button.primary, .btn.primary {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}
button.primary:hover, .btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }

/* Badges */
.badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 100px;
}
.badge.success { background: var(--success-bg); color: var(--success); }
.badge.warning { background: var(--warning-bg); color: var(--warning); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
    text-align: left;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    padding: 10px 8px;
    border-bottom: 1px solid var(--border);
}
td { padding: 10px 8px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }

/* Alerts */
.alert {
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 1.25rem;
    font-weight: 500;
}
.alert.success { background: var(--success-bg); color: var(--success); }
.alert.error { background: var(--danger-bg); color: var(--danger); }

/* Checkbox row */
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 1.1rem;
    font-size: 13.5px;
    color: var(--text-secondary);
}
.checkbox-row input[type=checkbox] { width: auto; }

/* Login */
.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--surface-0);
}

.login-box {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 2.25rem;
    width: 340px;
}

.login-box .brand {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    font-weight: 700;
    font-size: 17px;
    margin-bottom: 1.5rem;
}
.login-box .brand::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: var(--brand);
}

.login-box h1 { font-size: 17px; margin: 0 0 1.5rem; text-align: center; font-weight: 700; }
.login-box button { width: 100%; margin-top: 4px; }

.flex-row { display: flex; gap: 8px; align-items: center; }
.text-muted { color: var(--text-muted); font-size: 12px; }
