/* ============================================================
   INTERNA — app.css
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:        #185FA5;
  --blue-dark:   #0C447C;
  --blue-light:  #E6F1FB;
  --green:       #3B6D11;
  --green-light: #EAF3DE;
  --amber:       #854F0B;
  --amber-light: #FAEEDA;
  --red:         #A32D2D;
  --red-light:   #FCEBEB;
  --gray-text:   #444441;
  --gray-muted:  #888780;
  --gray-border: #D3D1C7;
  --gray-bg:     #F1EFE8;
  --white:       #FFFFFF;
  --radius:      8px;
  --radius-lg:   12px;
}

html, body { height: 100%; font-family: 'Inter', system-ui, sans-serif; font-size: 14px; color: var(--gray-text); background: var(--gray-bg); }

/* ── Login ────────────────────────────────────────────────── */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box { background: var(--white); border: 1px solid var(--gray-border); border-radius: var(--radius-lg); padding: 2rem; width: 360px; }
.login-logo { font-size: 24px; font-weight: 600; color: var(--blue-dark); letter-spacing: -0.03em; }
.login-sub { font-size: 12px; color: var(--gray-muted); margin-bottom: 1.5rem; }
.login-error { background: var(--red-light); color: var(--red); font-size: 12px; padding: 8px 12px; border-radius: var(--radius); margin-bottom: 1rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 12px; font-weight: 500; color: var(--gray-text); margin-bottom: 4px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; height: 36px; padding: 0 10px; font-size: 13px;
  border: 1px solid var(--gray-border); border-radius: var(--radius);
  background: var(--white); color: var(--gray-text); font-family: inherit;
}
.form-group textarea { height: 80px; padding: 8px 10px; resize: vertical; }
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(24,95,165,0.1); }
.btn-login { width: 100%; height: 38px; background: var(--blue); color: white; border: none; border-radius: var(--radius); font-size: 14px; font-weight: 500; cursor: pointer; margin-top: 0.5rem; }
.btn-login:hover { background: var(--blue-dark); }
.login-footer { font-size: 11px; color: var(--gray-muted); text-align: center; margin-top: 1rem; }
.login-footer a { color: var(--blue); text-decoration: none; }

/* ── App shell ────────────────────────────────────────────── */
.app-shell { display: grid; grid-template-columns: 210px 1fr; height: 100vh; }

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar { background: var(--white); border-right: 1px solid var(--gray-border); display: flex; flex-direction: column; overflow: hidden; }
.sidebar-logo { padding: 1.25rem 1rem 1rem; border-bottom: 1px solid var(--gray-border); }
.logo-text { font-size: 18px; font-weight: 600; color: var(--blue-dark); letter-spacing: -0.03em; display: block; }
.org-name { font-size: 11px; color: var(--gray-muted); display: block; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
nav { flex: 1; padding: 0.75rem 0; overflow-y: auto; }
.nav-section { font-size: 10px; font-weight: 500; color: var(--gray-muted); letter-spacing: 0.08em; text-transform: uppercase; padding: 0.75rem 1rem 0.25rem; }
.nav-item { display: flex; align-items: center; gap: 8px; padding: 7px 1rem; font-size: 13px; color: var(--gray-muted); cursor: pointer; text-decoration: none; border-right: 2px solid transparent; }
.nav-item:hover { background: var(--gray-bg); color: var(--gray-text); }
.nav-item.active { color: var(--blue); background: var(--blue-light); border-right-color: var(--blue); font-weight: 500; }
.sidebar-footer { padding: 0.75rem 1rem; border-top: 1px solid var(--gray-border); display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--gray-muted); }
.sidebar-footer button { font-size: 11px; background: none; border: 1px solid var(--gray-border); border-radius: var(--radius); padding: 3px 8px; cursor: pointer; color: var(--gray-muted); }

/* ── Main area ────────────────────────────────────────────── */
.main-area { overflow-y: auto; background: var(--gray-bg); }
.view { min-height: 100vh; }

/* ── Topbar ───────────────────────────────────────────────── */
.topbar { background: var(--white); border-bottom: 1px solid var(--gray-border); padding: 1rem 1.5rem; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10; }
.page-title { font-size: 15px; font-weight: 500; color: var(--gray-text); }
.page-sub { font-size: 11px; color: var(--gray-muted); margin-top: 2px; }
.topbar-actions { display: flex; gap: 8px; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn { height: 30px; padding: 0 12px; font-size: 12px; border: 1px solid var(--gray-border); border-radius: var(--radius); background: var(--white); color: var(--gray-text); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; font-family: inherit; }
.btn:hover { background: var(--gray-bg); }
.btn-primary { background: var(--blue); color: white; border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-dark); }
.btn-sm { height: 24px; padding: 0 8px; font-size: 11px; }

/* ── Content padding ──────────────────────────────────────── */
.content { padding: 1.25rem 1.5rem; }

/* ── Stats ────────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 1.25rem; }
.stat { background: var(--white); border: 1px solid var(--gray-border); border-radius: var(--radius); padding: 12px 14px; }
.stat-label { font-size: 11px; color: var(--gray-muted); margin-bottom: 4px; }
.stat-val { font-size: 22px; font-weight: 500; }
.stat-val.green { color: var(--green); }
.stat-val.amber { color: var(--amber); }
.stat-val.red   { color: var(--red); }

/* ── Alerts ───────────────────────────────────────────────── */
.alert { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: var(--radius); margin-bottom: 1rem; font-size: 12px; line-height: 1.5; }
.alert-amber { background: var(--amber-light); color: #633806; border-left: 3px solid #EF9F27; }
.alert-blue  { background: var(--blue-light);  color: #0C447C; border-left: 3px solid #378ADD; }
.alert-red   { background: var(--red-light);   color: var(--red); border-left: 3px solid var(--red); }
.alert a { color: inherit; font-weight: 500; cursor: pointer; }

/* ── Table ────────────────────────────────────────────────── */
.table-wrap { background: var(--white); border: 1px solid var(--gray-border); border-radius: var(--radius-lg); overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { text-align: left; font-size: 10px; font-weight: 500; color: var(--gray-muted); text-transform: uppercase; letter-spacing: 0.05em; padding: 8px 12px; border-bottom: 1px solid var(--gray-border); background: var(--gray-bg); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--gray-border); color: var(--gray-text); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafaf8; }
.ts { font-size: 11px; color: var(--gray-muted); font-family: 'SF Mono', 'Fira Code', monospace; }

/* ── Pills ────────────────────────────────────────────────── */
.pill { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 500; white-space: nowrap; }
.pill-green  { background: var(--green-light); color: var(--green); }
.pill-amber  { background: var(--amber-light); color: var(--amber); }
.pill-red    { background: var(--red-light);   color: var(--red); }
.pill-blue   { background: var(--blue-light);  color: var(--blue-dark); }
.pill-gray   { background: var(--gray-bg);     color: var(--gray-muted); }

/* ── Avatar ───────────────────────────────────────────────── */
.avatar { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 500; flex-shrink: 0; }

/* ── Tabs ─────────────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 1px solid var(--gray-border); margin-bottom: 1rem; }
.tab { padding: 7px 14px; font-size: 12px; cursor: pointer; color: var(--gray-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 500; }

/* ── Section header ──────────────────────────────────────── */
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-label { font-size: 12px; font-weight: 500; }
.section-meta { font-size: 11px; color: var(--gray-muted); }

/* ── Export cards ─────────────────────────────────────────── */
.export-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 1.5rem; }
.export-card { background: var(--white); border: 1px solid var(--gray-border); border-radius: var(--radius-lg); padding: 1rem; }
.export-card:hover { border-color: var(--blue); }
.export-icon { width: 32px; height: 32px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.export-title { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.export-desc { font-size: 11px; color: var(--gray-muted); line-height: 1.5; }

/* ── Modal ────────────────────────────────────────────────── */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: var(--white); border-radius: var(--radius-lg); width: 460px; max-width: 95vw; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--gray-border); }
.modal-title { font-size: 14px; font-weight: 500; }
.modal-close { background: none; border: none; font-size: 16px; cursor: pointer; color: var(--gray-muted); padding: 0 4px; }
.modal-body { padding: 1.25rem; }
.modal-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--gray-border); display: flex; gap: 8px; justify-content: flex-end; }
.modal-note { background: var(--blue-light); color: #0C447C; font-size: 11px; padding: 8px 10px; border-radius: var(--radius); margin-top: 1rem; line-height: 1.5; }

/* ── Loading ──────────────────────────────────────────────── */
.loading { display: flex; align-items: center; justify-content: center; padding: 3rem; color: var(--gray-muted); font-size: 13px; }

/* ── Toast ────────────────────────────────────────────────── */
.toast { position: fixed; bottom: 1.5rem; right: 1.5rem; background: var(--gray-text); color: white; padding: 10px 16px; border-radius: var(--radius); font-size: 13px; opacity: 0; transform: translateY(8px); transition: all 0.2s; pointer-events: none; z-index: 200; }
.toast.show { opacity: 1; transform: translateY(0); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .export-grid { grid-template-columns: 1fr; }
}

/* ── Row name cell ────────────────────────────────────────── */
.name-cell { display: flex; align-items: center; gap: 8px; }
