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

:root {
    --blue: #2563eb;
    --blue-hover: #1d4ed8;
    --blue-light: #93c5fd;
    --green: #16a34a;
    --green-bg: #f0fdf4;
    --green-border: #bbf7d0;
    --yellow: #ca8a04;
    --yellow-bg: #fefce8;
    --yellow-border: #fef08a;
    --red: #dc2626;
    --red-bg: #fef2f2;
    --red-border: #fecaca;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 640px;
    margin: 0 auto;
    padding: 0 16px 32px;
    background: #f5f5f5;
    color: var(--gray-900);
}

/* Navigation */
.nav {
    display: flex;
    gap: 4px;
    padding: 12px 0;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--gray-200);
    overflow-x: auto;
}
.nav a {
    text-decoration: none;
    color: var(--gray-500);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}
.nav a:hover { background: var(--gray-100); color: var(--gray-700); }
.nav a.active { background: var(--blue); color: white; }

/* Typography */
h1 { font-size: 24px; margin-bottom: 4px; }
h2 { font-size: 18px; margin: 24px 0 12px; }
.subtitle { color: var(--gray-500); margin-bottom: 16px; font-size: 14px; }

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Buttons */
.btn {
    background: var(--blue);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}
.btn:hover { background: var(--blue-hover); }
.btn:disabled { background: var(--blue-light); cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #b91c1c; }

/* Forms */
input[type="text"], input[type="number"], input[type="month"], select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    background: white;
}
input:focus, select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
label { display: block; margin-bottom: 4px; font-weight: 600; font-size: 13px; color: var(--gray-700); }
.form-group { margin-bottom: 12px; }
.form-row { display: flex; gap: 8px; align-items: flex-end; }
.form-row .form-group { flex: 1; margin-bottom: 0; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; padding: 8px 12px; border-bottom: 2px solid var(--gray-200); color: var(--gray-500); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
td { padding: 8px 12px; border-bottom: 1px solid var(--gray-100); }
td.num, th.num { text-align: right; }

/* Progress bar */
.progress-wrap { margin-top: 4px; }
.progress-bar {
    height: 8px;
    background: var(--gray-100);
    border-radius: 4px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}
.progress-fill.green { background: var(--green); }
.progress-fill.yellow { background: var(--yellow); }
.progress-fill.red { background: var(--red); }

/* Status pills */
.pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.pill-green { background: var(--green-bg); color: var(--green); }
.pill-yellow { background: var(--yellow-bg); color: var(--yellow); }
.pill-red { background: var(--red-bg); color: var(--red); }

/* Stat grid */
.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}
.stat-card {
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.stat-value { font-size: 24px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

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

/* Alert */
.alert { padding: 12px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; }
.alert-success { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.alert-error { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }
