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

:root {
  --blue:    #4472C4;
  --blue-dk: #2f569e;
  --blue-lt: #dce6f1;
  --total:   #D9E1F2;
  --bg:      #f4f6fb;
  --card:    #ffffff;
  --text:    #1a1a2e;
  --muted:   #6b7280;
  --border:  #e2e8f0;
  --success: #16a34a;
  --error:   #dc2626;
  --radius:  8px;
  --shadow:  0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
}

body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }

/* ── Login ── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }

.login-card {
  background: var(--card); border-radius: 12px; box-shadow: var(--shadow);
  padding: 48px 40px; width: 100%; max-width: 380px; text-align: center;
}
.login-card h1 { font-size: 22px; font-weight: 700; color: var(--blue); margin-bottom: 4px; }
.login-card .subtitle { color: var(--muted); font-size: 13px; margin-bottom: 32px; }

.form-group { text-align: left; margin-bottom: 20px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 6px; }
.form-group input {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 15px; outline: none; transition: border-color .2s;
}
.form-group input:focus { border-color: var(--blue); }

.error-message {
  background: #fef2f2; border: 1px solid #fca5a5; color: var(--error);
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 20px; font-size: 13px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px;
  border: 1.5px solid transparent; border-radius: var(--radius); font-size: 13px;
  font-weight: 600; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn-primary   { background: var(--blue); color: #fff; }
.btn-primary:hover  { background: var(--blue-dk); }
.btn-outline   { background: #fff; color: var(--blue); border-color: var(--blue); }
.btn-outline:hover  { background: var(--blue-lt); }
.btn-outline.active { background: var(--blue); color: #fff; }
.btn-full      { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }
.btn:disabled  { opacity: .5; cursor: not-allowed; }

/* ── Top nav ── */
.navbar {
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 0 32px; height: 56px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.navbar-brand { font-size: 16px; font-weight: 700; color: var(--blue); }
.navbar-right  { display: flex; align-items: center; gap: 12px; }
.navbar a.logout { font-size: 13px; color: var(--muted); text-decoration: none; }
.navbar a.logout:hover { color: var(--error); }

/* ── Layout ── */
.page-content { max-width: 1100px; margin: 0 auto; padding: 32px 24px; }

/* ── Controls card ── */
.controls-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px 28px; margin-bottom: 24px;
}
.controls-card h2 { font-size: 15px; font-weight: 700; margin-bottom: 16px; color: var(--text); }
.range-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.month-input {
  padding: 9px 12px; border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 13px; outline: none; transition: border-color .2s; display: none;
}
.month-input:focus { border-color: var(--blue); }
.month-input.visible { display: inline-block; }

.generate-row { display: flex; align-items: center; gap: 16px; }
.status-text  { font-size: 13px; color: var(--muted); }
.status-text.running { color: var(--blue); }
.status-text.done    { color: var(--success); }
.status-text.err     { color: var(--error); }

/* spinner */
.spinner {
  display: inline-block; width: 14px; height: 14px; border: 2px solid var(--blue-lt);
  border-top-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error list ── */
.error-list {
  background: #fef2f2; border: 1px solid #fca5a5; color: var(--error);
  border-radius: var(--radius); padding: 12px 16px; margin-top: 12px; font-size: 13px;
}
.error-list ul { margin: 6px 0 0 16px; }

/* ── File browser ── */
.browser-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px;
}
.browser-header {
  padding: 16px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.browser-header h3 { font-size: 14px; font-weight: 700; }
.date-badge {
  background: var(--blue-lt); color: var(--blue); font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
}

.site-section { padding: 16px 24px; border-bottom: 1px solid var(--border); }
.site-section:last-child { border-bottom: none; }
.site-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); margin-bottom: 10px;
}

.file-grid { display: flex; flex-direction: column; gap: 6px; }
.file-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 12px; border-radius: 6px; background: var(--bg);
}
.file-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.file-icon { font-size: 16px; flex-shrink: 0; }
.file-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.btn-download {
  padding: 5px 12px; font-size: 12px; border-radius: 5px;
  background: var(--blue-lt); color: var(--blue); border: none;
  font-weight: 600; cursor: pointer; text-decoration: none; flex-shrink: 0;
  transition: background .15s;
}
.btn-download:hover { background: var(--blue); color: #fff; }

/* empty state */
.empty-state { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty-state .icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }
