:root {
  color-scheme: light;
  --ink: #172234;
  --muted: #667085;
  --line: #dbe1e8;
  --soft: #f4f7fa;
  --blue: #075baa;
  --blue-dark: #064780;
  --red: #e71920;
  --green: #087a55;
  --amber: #9a5b00;
  --white: #fff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: #eef2f6; color: var(--ink); }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.admin-shell { min-height: 100vh; }
.login-view {
  width: min(440px, calc(100% - 32px));
  margin: 9vh auto 40px;
  padding: 32px;
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 4px solid var(--red);
  border-radius: 8px;
  box-shadow: 0 18px 55px rgba(23, 34, 52, .12);
}
.login-brand, .admin-brand { display: flex; align-items: center; gap: 13px; }
.login-brand img { width: 76px; height: 76px; object-fit: contain; }
.login-brand span, .admin-brand span, .page-heading p, .detail-dialog span { color: var(--blue); font-size: 12px; font-weight: 800; }
.login-brand h1 { margin: 3px 0 0; font-size: 25px; }
.login-copy { margin: 22px 0; color: var(--muted); line-height: 1.6; }
.login-view form { display: grid; gap: 13px; }
.login-view label, .search-field { display: grid; gap: 7px; color: #344054; font-size: 13px; font-weight: 700; }
.login-view input, .search-field input {
  width: 100%; min-height: 46px; padding: 10px 12px; color: var(--ink); background: #fff;
  border: 1px solid #b8c2cf; border-radius: 6px; outline: none;
}
.login-view input:focus, .search-field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(7, 91, 170, .12); }
.primary-action, .secondary-action, .logout-action, .text-action {
  min-height: 42px; padding: 9px 15px; border-radius: 6px; font-weight: 750; border: 1px solid transparent;
}
.primary-action { background: var(--blue); color: #fff; }
.primary-action:hover { background: var(--blue-dark); }
.secondary-action { background: #fff; color: var(--blue); border-color: #aebdca; }
.logout-action { background: #fff; color: #b42318; border-color: #e8b8b4; }
.text-action { background: transparent; color: var(--blue); }
.form-status { min-height: 22px; margin: 15px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.form-status.error { color: #b42318; }

.dashboard-view { min-height: 100vh; }
.admin-header {
  min-height: 72px; padding: 10px clamp(18px, 4vw, 52px); display: flex; align-items: center; justify-content: space-between;
  gap: 18px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.admin-brand { color: inherit; text-decoration: none; }
.admin-brand img { width: 48px; height: 48px; object-fit: contain; }
.admin-brand div { display: grid; gap: 2px; }
.admin-brand strong { font-size: 16px; }
.header-actions { display: flex; gap: 8px; }
.page-heading { padding: 34px clamp(18px, 4vw, 52px) 22px; background: #fff; border-bottom: 1px solid var(--line); }
.page-heading p { margin: 0 0 6px; }
.page-heading h1 { margin: 0 0 8px; font-size: clamp(25px, 3vw, 34px); letter-spacing: 0; }
.page-heading span { color: var(--muted); font-size: 13px; }

.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; padding: 22px clamp(18px, 4vw, 52px); }
.summary-grid article { min-height: 122px; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: 7px; display: grid; align-content: space-between; }
.summary-grid article:nth-child(1) { border-top: 3px solid var(--blue); }
.summary-grid article:nth-child(2) { border-top: 3px solid var(--red); }
.summary-grid article:nth-child(3) { border-top: 3px solid var(--green); }
.summary-grid article:nth-child(4) { border-top: 3px solid #f0a000; }
.summary-grid span { color: var(--muted); font-size: 13px; font-weight: 700; }
.summary-grid strong { margin: 6px 0; font-size: 27px; }
.summary-grid small { color: var(--muted); }

.data-workspace { margin: 0 clamp(18px, 4vw, 52px) 48px; background: #fff; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.data-tabs { display: flex; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.data-tabs button { min-height: 54px; padding: 0 18px; white-space: nowrap; color: var(--muted); background: #fff; border: 0; border-bottom: 3px solid transparent; font-weight: 750; }
.data-tabs button.active { color: var(--blue); border-bottom-color: var(--blue); }
.data-tabs span { display: inline-grid; min-width: 23px; height: 23px; margin-left: 6px; padding: 0 6px; place-items: center; background: var(--soft); border-radius: 12px; font-size: 11px; }
.table-tools { display: flex; justify-content: space-between; align-items: end; gap: 12px; padding: 18px; border-bottom: 1px solid var(--line); }
.search-field { width: min(520px, 100%); }
.table-status { min-height: 0; padding: 0 18px; color: var(--muted); font-size: 13px; }
.table-status:not(:empty) { padding-top: 12px; }
.table-scroll { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 12px 14px; color: #475467; background: var(--soft); border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
td { padding: 14px; border-bottom: 1px solid #ebeff3; vertical-align: top; }
tbody tr:hover { background: #f8fafc; }
td strong, td span { display: block; }
td small { display: block; margin-top: 3px; color: var(--muted); }
.row-action { padding: 6px 10px; color: var(--blue); background: #fff; border: 1px solid #aebdca; border-radius: 5px; font-weight: 700; }
.status-pill { display: inline-flex; width: fit-content; padding: 4px 8px; border-radius: 4px; color: #344054; background: #e9eef3; font-size: 11px; font-weight: 800; }
.status-pill.success { color: #06613f; background: #dff6eb; }
.status-pill.warning { color: #7a4700; background: #fff0cc; }
.status-pill.danger { color: #a3241b; background: #fde5e3; }
.empty-state { padding: 50px 20px; text-align: center; }
.empty-state strong { font-size: 18px; }
.empty-state p { max-width: 480px; margin: 8px auto 0; color: var(--muted); line-height: 1.5; }

.detail-dialog { width: min(650px, calc(100% - 28px)); max-height: 86vh; padding: 0; color: var(--ink); border: 0; border-radius: 8px; box-shadow: 0 24px 90px rgba(10, 20, 35, .28); }
.detail-dialog::backdrop { background: rgba(12, 20, 32, .58); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.dialog-heading h2 { margin: 3px 0 0; font-size: 22px; }
.dialog-heading button { width: 38px; height: 38px; color: #667085; background: #fff; border: 1px solid var(--line); border-radius: 50%; font-size: 24px; line-height: 1; }
#detail-content { padding: 8px 22px 18px; overflow-wrap: anywhere; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.detail-field { padding: 14px 0; border-bottom: 1px solid #ebeff3; }
.detail-field span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.detail-field strong { display: block; font-size: 14px; line-height: 1.45; }
.dialog-actions { display: flex; gap: 9px; justify-content: flex-end; padding: 15px 22px; background: var(--soft); border-top: 1px solid var(--line); }

@media (max-width: 900px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .login-view { margin-top: 28px; padding: 24px 20px; }
  .login-brand img { width: 64px; height: 64px; }
  .admin-header { align-items: flex-start; padding: 10px 14px; }
  .admin-brand img { width: 42px; height: 42px; }
  .admin-brand span { display: none; }
  .header-actions button { min-height: 38px; padding: 7px 10px; font-size: 12px; }
  .page-heading { padding: 26px 16px 18px; }
  .summary-grid { grid-template-columns: 1fr 1fr; gap: 9px; padding: 14px 12px; }
  .summary-grid article { min-height: 110px; padding: 13px; }
  .summary-grid strong { font-size: 21px; }
  .data-workspace { margin: 0 12px 28px; }
  .data-tabs button { padding: 0 13px; }
  .table-tools { align-items: stretch; flex-direction: column; padding: 14px; }
  .table-tools .secondary-action { width: 100%; }
  th, td { padding: 11px 10px; }
  .detail-grid { grid-template-columns: 1fr; }
}
