/* ── Reset & Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:      #1a4f8a;
  --blue-mid:  #2563a8;
  --blue-lt:   #e8f1fb;
  --green:     #1a7a3a;
  --green-lt:  #e6f5ec;
  --red:       #c0392b;
  --red-lt:    #fdecea;
  --orange:    #d35400;
  --gray:      #6b7280;
  --gray-lt:   #f3f4f6;
  --border:    #d1d5db;
  --text:      #1f2937;
  --text-soft: #6b7280;
  --white:     #ffffff;
  --font:      'Segoe UI', Arial, sans-serif;
  --radius:    6px;
  --shadow:    0 1px 4px rgba(0,0,0,0.08);
  --shadow-md: 0 2px 12px rgba(0,0,0,0.12);
}

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: #f0f4f8;
}

a { color: var(--blue-mid); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: 'Consolas', 'Courier New', monospace; font-size: 12px;
       background: var(--gray-lt); padding: 1px 5px; border-radius: 3px; }

/* ── Layout ──────────────────────────────────────────────────────── */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

.footer {
  text-align: center;
  padding: 16px;
  font-size: 11px;
  color: var(--text-soft);
  border-top: 1px solid var(--border);
  background: var(--white);
}

/* ── Navbar ──────────────────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--blue);
  padding: 0 24px;
  height: 52px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.nav-brand { display: flex; align-items: center; gap: 8px; }
.nav-logo  { font-size: 20px; }
.nav-title { color: #fff; font-weight: 700; font-size: 15px; }
.nav-sub   { color: rgba(255,255,255,0.55); font-size: 13px; }

.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-links a {
  color: rgba(255,255,255,0.75);
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-links a:hover, .nav-links a.active {
  background: rgba(255,255,255,0.15);
  color: #fff;
  text-decoration: none;
}

.nav-user { display: flex; align-items: center; gap: 12px; }
.nav-username { color: rgba(255,255,255,0.85); font-size: 13px; }
.nav-link-sm  { color: rgba(255,255,255,0.6); font-size: 12px; }
.nav-link-sm:hover { color: #fff; text-decoration: none; }

/* ── Alerts ──────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 500;
}
.alert-success { background: var(--green-lt); color: var(--green); border: 1px solid #a7d7b7; }
.alert-error   { background: var(--red-lt);   color: var(--red);   border: 1px solid #f5b7b1; }
.alert-info    { background: var(--blue-lt);  color: var(--blue);  border: 1px solid #b3cde8; }

/* ── Page Header ─────────────────────────────────────────────────── */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 22px; color: var(--blue); font-weight: 700; }
.page-sub { color: var(--text-soft); margin-top: 4px; font-size: 13px; }

/* ── Cards ───────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.card-narrow { max-width: 560px; }
.card-title  { font-weight: 700; font-size: 14px; color: var(--blue); margin-bottom: 4px; }
.card-sub    { font-size: 12px; color: var(--text-soft); margin-bottom: 16px; }

.info-card   { background: var(--blue-lt); border-color: #b3cde8; max-width: 560px; }
.info-title  { font-weight: 700; color: var(--blue); margin-bottom: 10px; }
.info-list   { padding-left: 18px; }
.info-list li { margin-bottom: 6px; font-size: 13px; color: var(--text); }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, box-shadow 0.15s;
  text-decoration: none;
}
.btn:hover { opacity: 0.88; text-decoration: none; }
.btn-primary { background: var(--blue-mid); color: #fff; }
.btn-outline  { background: transparent; color: var(--blue-mid); border: 1px solid var(--blue-mid); }
.btn-danger   { background: var(--red); color: #fff; }
.btn-sm       { padding: 5px 12px; font-size: 12px; }
.btn-lg       { padding: 11px 28px; font-size: 15px; }
.btn-full     { width: 100%; justify-content: center; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Forms ───────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.hint { font-weight: 400; color: var(--text-soft); font-size: 12px; }

input[type=text], input[type=password], select, textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
  background: var(--white);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 3px rgba(37,99,168,0.12);
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.inline-form input, .inline-form select { width: auto; }
.input-lg   { width: 240px !important; }
.input-wide { flex: 1; min-width: 180px; }

.form-actions { display: flex; gap: 10px; margin-top: 20px; align-items: center; }

/* ── Tables ──────────────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.table th {
  background: var(--blue);
  color: #fff;
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--gray-lt); }
.empty-row { text-align: center; color: var(--text-soft); padding: 24px !important; }

.mono  { font-family: 'Consolas', 'Courier New', monospace; font-size: 12px; }
.small { font-size: 12px; }
.muted { color: var(--text-soft); }
.bold  { font-weight: 600; }

/* ── Badges ──────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.badge-green { background: var(--green-lt); color: var(--green); }
.badge-blue  { background: var(--blue-lt);  color: var(--blue-mid); }
.badge-red   { background: var(--red-lt);   color: var(--red); }
.badge-gray  { background: var(--gray-lt);  color: var(--gray); }

/* ── Tabs ────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.tab {
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  border-radius: var(--radius) var(--radius) 0 0;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}
.tab:hover { background: var(--gray-lt); color: var(--text); text-decoration: none; }
.tab.active {
  background: var(--white);
  color: var(--blue);
  border: 2px solid var(--border);
  border-bottom: 2px solid var(--white);
  margin-bottom: -2px;
}
.tab-count {
  display: inline-block;
  background: var(--border);
  color: var(--text-soft);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  margin-left: 4px;
}
.tab.active .tab-count { background: var(--blue-lt); color: var(--blue-mid); }

/* ── Dashboard Grid ──────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.dash-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow 0.15s, transform 0.12s;
  box-shadow: var(--shadow);
}
.dash-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }
.dash-card-primary { border-top: 3px solid var(--blue-mid); }
.dash-icon  { font-size: 28px; margin-bottom: 10px; }
.dash-label { font-size: 15px; font-weight: 700; color: var(--blue); margin-bottom: 6px; }
.dash-desc  { font-size: 12px; color: var(--text-soft); line-height: 1.5; }

.section-header {
  font-size: 15px;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 12px;
}

/* ── Upload Zone ─────────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
  margin-bottom: 20px;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--blue-mid);
  background: var(--blue-lt);
}
.upload-zone.has-file { border-color: var(--green); background: var(--green-lt); }
.upload-icon  { font-size: 36px; margin-bottom: 10px; }
.upload-label { font-weight: 600; font-size: 15px; color: var(--text); margin-bottom: 6px; }
.upload-hint  { font-size: 12px; color: var(--text-soft); }
.upload-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.upload-filename { margin-top: 12px; font-weight: 600; color: var(--green); font-size: 14px; }

/* ── Spinner ─────────────────────────────────────────────────────── */
.spinner-wrap  { text-align: center; padding: 32px; }
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--blue-mid);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-label { color: var(--text-soft); font-size: 14px; }

/* ── Result States ───────────────────────────────────────────────── */
.result-icon  { font-size: 48px; text-align: center; margin-bottom: 12px; }
.result-title { font-size: 18px; font-weight: 700; text-align: center; margin-bottom: 20px; }
.result-success .result-title { color: var(--green); }
.result-error   .result-title { color: var(--red); }
.result-note  { text-align: center; color: var(--text-soft); font-size: 12px; margin-top: 12px; }

/* ── Log Output ──────────────────────────────────────────────────── */
.log-header { font-weight: 700; font-size: 13px; color: var(--blue); margin-bottom: 10px; }
.log-output {
  background: #1e2229;
  color: #d4d4d4;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12px;
  padding: 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  white-space: pre-wrap;
  max-height: 400px;
  overflow-y: auto;
  line-height: 1.6;
}

/* ── Login ───────────────────────────────────────────────────────── */
.login-body { background: linear-gradient(135deg, #1a4f8a 0%, #2d6cb0 100%); min-height: 100vh;
              display: flex; align-items: center; justify-content: center; }
.login-wrap { width: 100%; max-width: 400px; padding: 24px; }
.login-card { background: var(--white); border-radius: 10px; padding: 40px 36px;
              box-shadow: 0 8px 32px rgba(0,0,0,0.18); }
.login-logo  { font-size: 40px; text-align: center; margin-bottom: 12px; }
.login-title { font-size: 18px; font-weight: 700; color: var(--blue); text-align: center; margin-bottom: 4px; }
.login-sub   { font-size: 13px; color: var(--text-soft); text-align: center; margin-bottom: 28px; }
.login-form .form-group { margin-bottom: 18px; }

/* ── Empty State ─────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 24px; }
.empty-icon  { font-size: 48px; margin-bottom: 12px; }
.empty-label { font-size: 16px; color: var(--text-soft); margin-bottom: 20px; }
