*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f1f5f9; color: #1e293b; }

/* Navbar */
.navbar { background: #1e293b; color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 2rem; height: 52px; }
.nav-brand { font-weight: 700; font-size: 1.1rem; letter-spacing: .5px; }
.nav-links a { color: #94a3b8; text-decoration: none; margin-left: 1.5rem; font-size: .9rem; }
.nav-links a:hover { color: #fff; }

main { padding: 2rem; max-width: 1400px; margin: 0 auto; }

/* Login */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #f1f5f9; }
.login-card { background: #fff; border-radius: 12px; padding: 2.5rem 2rem; width: 340px; box-shadow: 0 4px 24px rgba(0,0,0,.08); }
.login-logo { font-size: 1.4rem; font-weight: 800; color: #1e293b; margin-bottom: 1.5rem; text-align: center; }
.login-card label { display: block; font-size: .85rem; font-weight: 600; color: #475569; margin-bottom: .4rem; }
.login-card input { width: 100%; padding: .6rem .8rem; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 1rem; margin-bottom: 1rem; }
.login-card button { width: 100%; padding: .7rem; background: #2563eb; color: #fff; border: none; border-radius: 6px; font-size: 1rem; font-weight: 600; cursor: pointer; }
.login-card button:hover { background: #1d4ed8; }
.error-msg { color: #dc2626; font-size: .85rem; margin-bottom: .8rem; }

/* Page header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; flex-wrap: wrap; gap: .5rem; }
.page-header h1 { font-size: 1.4rem; font-weight: 700; display: flex; align-items: center; gap: .6rem; }
.month-label { background: #e2e8f0; color: #475569; font-size: .9rem; font-weight: 600; padding: .2rem .7rem; border-radius: 999px; }
.month-nav select { padding: .4rem .8rem; border: 1px solid #cbd5e1; border-radius: 6px; font-size: .9rem; cursor: pointer; }

/* Alerts */
.alert { background: #fef9c3; border: 1px solid #fde047; color: #854d0e; padding: .8rem 1rem; border-radius: 8px; margin-bottom: 1.5rem; }
.alert a { color: #2563eb; }
.alert-warn { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; padding: .6rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .9rem; }

/* Section */
.section { margin-bottom: 2.5rem; }
.section-title { font-size: 1rem; font-weight: 700; color: #475569; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 1rem; }

/* KPI Cards */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
.kpi-card { background: #fff; border-radius: 10px; padding: 1rem 1.2rem; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.kpi-label { font-size: .78rem; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: .04em; margin-bottom: .4rem; }
.kpi-ist { font-size: 1.5rem; font-weight: 800; color: #1e293b; margin-bottom: .4rem; }
.kpi-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.kpi-up { font-size: .8rem; color: #94a3b8; }

/* Delta Pills */
.delta-pill { display: inline-block; font-size: .75rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px; }
.delta-green { background: #dcfce7; color: #15803d; }
.delta-red   { background: #fee2e2; color: #b91c1c; }

/* Channel Table */
.table-wrap { overflow-x: auto; }
.channel-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.06); font-size: .85rem; }
.channel-table th { background: #f8fafc; color: #64748b; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: .6rem .8rem; text-align: right; border-bottom: 1px solid #e2e8f0; }
.channel-table th:first-child { text-align: left; }
.channel-table td { padding: .55rem .8rem; text-align: right; border-bottom: 1px solid #f1f5f9; color: #334155; }
.channel-table td:first-child { text-align: left; }
.subhead th { background: #f1f5f9; font-size: .7rem; padding: .35rem .8rem; }
.ch-name { font-weight: 600; color: #1e293b; }
.up-col { color: #94a3b8; }
.row-total td { background: #eff6ff; font-weight: 700; }
.row-dimmed td { opacity: .6; }

/* Upload */
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 768px) { .upload-grid { grid-template-columns: 1fr; } }
.card { background: #fff; border-radius: 10px; padding: 1.5rem; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.card h2 { font-size: 1rem; font-weight: 700; margin-bottom: 1.2rem; color: #1e293b; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; color: #475569; margin-bottom: .35rem; }
.form-group input { width: 100%; padding: .55rem .75rem; border: 1px solid #cbd5e1; border-radius: 6px; font-size: .95rem; }
.btn-primary { background: #2563eb; color: #fff; border: none; border-radius: 6px; padding: .65rem 1.4rem; font-size: .95rem; font-weight: 600; cursor: pointer; }
.btn-primary:hover { background: #1d4ed8; }
.btn-sm { background: #e2e8f0; color: #334155; text-decoration: none; padding: .25rem .7rem; border-radius: 5px; font-size: .8rem; font-weight: 600; }
.btn-sm:hover { background: #cbd5e1; }
.upload-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.upload-table th { color: #64748b; font-weight: 600; font-size: .75rem; text-transform: uppercase; padding: .4rem .5rem; border-bottom: 1px solid #e2e8f0; text-align: left; }
.upload-table td { padding: .45rem .5rem; border-bottom: 1px solid #f1f5f9; }
.badge-ok { color: #16a34a; font-weight: 700; }
.badge-miss { color: #94a3b8; }
.muted { color: #94a3b8; font-size: .8rem; }

/* Charts */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 900px) { .charts-grid { grid-template-columns: 1fr; } }
.chart-card { background: #fff; border-radius: 10px; padding: 1.2rem 1.5rem; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.chart-card h3 { font-size: .9rem; font-weight: 700; color: #475569; margin-bottom: 1rem; }

/* Tabs */
.tabs { display: flex; gap: .5rem; margin-bottom: 1.5rem; border-bottom: 2px solid #e2e8f0; padding-bottom: 0; }
.tab-btn { background: none; border: none; padding: .6rem 1.2rem; font-size: .95rem; font-weight: 600; color: #64748b; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tab-btn:hover { color: #1e293b; }
.tab-btn.active { color: #2563eb; border-bottom-color: #2563eb; }

/* Month block in upload */
.month-block { border: 1px solid #e2e8f0; border-radius: 8px; padding: 1rem 1.2rem; margin-bottom: 1rem; }
.month-block-header { display: flex; align-items: center; gap: 1rem; margin-bottom: .8rem; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .5rem; }
.file-slot { display: flex; align-items: center; justify-content: space-between; padding: .4rem .7rem; border-radius: 6px; font-size: .82rem; }
.file-exists { background: #dcfce7; color: #15803d; }
.file-missing { background: #f1f5f9; color: #94a3b8; }
.file-label { font-weight: 600; }
.btn-delete { background: none; border: none; color: #dc2626; font-size: .85rem; cursor: pointer; padding: 0 .2rem; font-weight: 700; }
.btn-delete:hover { color: #991b1b; }

/* Month nav links */
.month-link { display: inline-block; padding: .3rem .8rem; border-radius: 6px; text-decoration: none; font-size: .9rem; font-weight: 600; color: #64748b; }
.month-link:hover { background: #e2e8f0; color: #1e293b; }
.month-link.active { background: #2563eb; color: #fff; }

.pie-wrap { display: flex; justify-content: center; padding: 1rem 0; }
.pie-wrap { display: flex; justify-content: center; padding: 1rem 0; }
