*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #f5f5f7;
    --card: #fff;
    --text: #1d1d1f;
    --muted: #6e6e73;
    --primary: #0071e3;
    --primary-hover: #0077ed;
    --danger: #ff3b30;
    --success: #34c759;
    --warning: #ff9500;
    --border: #d2d2d7;
    --radius: 12px;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100dvh;
}

/* Layout */
.container { max-width: 600px; margin: 0 auto; padding: 16px; }
header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
header .brand { font-weight: 700; font-size: 1.1rem; }
header nav a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    margin-left: 16px;
}

/* Cards */
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
}
.card h3 { font-size: 1rem; margin-bottom: 8px; }
.card p { color: var(--muted); font-size: 0.9rem; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 6px;
}
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], textarea, select {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    color: var(--text);
    -webkit-appearance: none;
}
textarea { min-height: 120px; resize: vertical; font-family: inherit; }
select { cursor: pointer; }

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-block { display: block; width: 100%; }
.btn + .btn { margin-left: 8px; }

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-pending { background: #fff3e0; color: var(--warning); }
.badge-approved { background: #e8f5e9; color: var(--success); }
.badge-locked { background: #e3f2fd; color: var(--primary); }

/* Lists */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item-content { flex: 1; min-width: 0; }
.list-item-content .title { font-weight: 600; font-size: 0.95rem; }
.list-item-content .subtitle { color: var(--muted); font-size: 0.85rem; }

/* Utility */
.text-muted { color: var(--muted); }
.text-center { text-align: center; }
.text-sm { font-size: 0.85rem; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex-row { display: flex; gap: 8px; align-items: center; }
.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 24px 0 12px;
}
.section-title:first-child { margin-top: 8px; }

/* Alert */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}
.alert-error { background: #ffeaea; color: var(--danger); }
.alert-success { background: #e8f5e9; color: #2e7d32; }
.alert-info { background: #e3f2fd; color: var(--primary); }

/* Checkboxes in forms */
.checkbox-list label {
    display: flex;
    align-items: center;
    padding: 8px 0;
    font-weight: 400;
    cursor: pointer;
}
.checkbox-list input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    -webkit-appearance: checkbox;
}

/* Actions row */
.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Empty state */
.empty { text-align: center; color: var(--muted); padding: 32px 16px; }

/* Login page */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 16px;
}
.login-box {
    width: 100%;
    max-width: 400px;
}
.login-box h1 {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 24px;
}

/* Responsive: wider on tablet+ */
@media (min-width: 768px) {
    .container { max-width: 800px; padding: 24px; }
}
