:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --ink: #102038;
  --muted: #5e6f85;
  --line: #d7e0ea;
  --brand: #0b5fff;
  --brand-2: #083b9a;
  --danger: #b42318;
  --ok: #067647;
  --warn: #b54708;
  --shadow: 0 10px 24px rgba(16, 32, 56, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: linear-gradient(180deg, #f7fbff 0%, #eef4fa 100%);
  color: var(--ink);
  font: 14px/1.45 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; }
.page { padding: 1rem 0 2rem; }
.row { display: flex; }
.center { align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.gap-sm { gap: .5rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.small { font-size: 12px; }
.muted { color: var(--muted); }

.site-header {
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header .container { min-height: 58px; }
.brand { font-weight: 700; font-size: 15px; color: var(--ink); }
.brand-wrap { display: inline-flex; align-items: center; gap: .55rem; color: inherit; text-decoration: none; }
.brand-wrap:hover { text-decoration: none; }
.brand-logo { width: 28px; height: 28px; display: inline-block; border-radius: 8px; }
.brand-text { display: inline-flex; flex-direction: column; line-height: 1.05; }
.brand-sub { font-size: 10px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.nav { display: flex; gap: .75rem; flex-wrap: wrap; }
.nav a { padding: .35rem .55rem; border-radius: 999px; }
.nav a:hover { background: #edf3ff; text-decoration: none; }

.toolbar {
  padding: .75rem 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 1rem;
}
.card h2, .card h3 { margin-top: 0; }
.hero { padding: 1.1rem 1.2rem; }
.kpi { display: grid; grid-template-columns: auto 1fr; gap: .4rem .75rem; }
.kpi .value { font-size: 1.4rem; font-weight: 700; }
.kpi .label { color: var(--muted); }

.notice {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 10px;
  background: #fff;
  padding: .75rem .9rem;
  margin-bottom: .75rem;
}
.notice.success { border-left-color: #16a34a; }
.notice.warn { border-left-color: #f59e0b; }
.notice.error { border-left-color: #ef4444; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .15rem .5rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-admin { background: #e0ecff; color: #123d8f; }
.badge-agent { background: #ebfff5; color: #05603a; }
.badge-breakglass { background: #fff3f2; color: #b42318; border-color: #fecdca; }
.badge-open { background: #eff6ff; color: #1d4ed8; }
.badge-progress { background: #fff7ed; color: #c2410c; }
.badge-closed { background: #ecfdf3; color: #027a48; }
.badge-low { background: #f2f4f7; color: #344054; }
.badge-medium { background: #fff7ed; color: #b54708; }
.badge-high { background: #fef3f2; color: #b42318; }
.badge-critical { background: #fee4e2; color: #912018; border-color: #fda29b; }
.badge-default { background: #eef2f6; color: #475467; }
.badge-invoiced-yes { background: #ecfdf3; color: #027a48; }
.badge-invoiced-no { background: #fef3f2; color: #b42318; }

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  padding: .5rem .75rem;
  cursor: pointer;
  font-weight: 600;
}
.btn:hover { filter: brightness(.99); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #0a54de; }
.btn-danger { background: #b42318; border-color: #b42318; color: #fff; }
.btn-light { background: #fff; }

form .stack { display: grid; gap: .75rem; }
label { display: grid; gap: .3rem; font-weight: 600; }
label.inline { display: inline-flex; align-items: center; gap: .4rem; font-weight: 500; }
input, select, textarea {
  width: 100%;
  border: 1px solid #cfd8e3;
  border-radius: 10px;
  padding: .55rem .65rem;
  font: inherit;
  color: inherit;
  background: #fff;
}
select[multiple] { min-height: 110px; }
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus, a:focus {
  outline: 2px solid rgba(11, 95, 255, .25);
  outline-offset: 1px;
  border-color: #94b5ff;
}

.table-wrap { overflow: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}
.table th, .table td {
  border-bottom: 1px solid var(--line);
  padding: .55rem .5rem;
  text-align: left;
  vertical-align: top;
}
.table th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

.login-shell {
  min-height: calc(100vh - 58px);
  display: grid;
  place-items: center;
  padding: 2rem 0;
}
.login-card {
  width: min(520px, calc(100% - 1rem));
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1.2rem;
}
.login-card h1 { margin-top: 0; }
.login-brand { display: flex; align-items: center; gap: .75rem; margin-bottom: .5rem; }
.login-brand img { width: 40px; height: 40px; border-radius: 10px; }

pre, code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: .75rem;
  border-radius: 10px;
  overflow: auto;
}

.actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.site-footer { padding: 1rem 0 2rem; }
.mt-1 { margin-top: 1rem; }
.mt-075 { margin-top: .75rem; }
.m-0 { margin: 0; }
.report-page .table { min-width: 0; }

@media print {
  body {
    background: #fff !important;
    color: #000;
    font-size: 12px;
  }
  .site-header,
  .site-footer,
  .toolbar,
  .no-print,
  .actions,
  .notice.success,
  .notice.warn,
  .notice.error {
    display: none !important;
  }
  .container {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .page {
    padding: 0 !important;
  }
  .card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
    margin-bottom: 8px;
  }
  a {
    color: #000 !important;
    text-decoration: none !important;
  }
  .badge {
    border: 1px solid #777 !important;
    background: transparent !important;
    color: #000 !important;
  }
  .table-wrap {
    overflow: visible !important;
  }
  .table th,
  .table td {
    font-size: 11px;
  }
}

@media (max-width: 700px) {
  .nav { display: none; }
  .table { min-width: 560px; }
  .toolbar { align-items: flex-start; }
}
