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

:root {
  --brand:       #016481;
  --brand-dark:  #014f65;
  --brand-light: #e6f4f8;
  --white:       #ffffff;
  --text:        #1a2e35;
  --text-muted:  #5a7a85;
  --border:      #c8dfe6;
  --row-alt:     #f0f8fb;
  --shadow:      0 2px 12px rgba(1,100,129,.12);
  --radius:      8px;
  --font:        'Segoe UI', system-ui, sans-serif;
}

html { font-size: 15px; }

body {
  font-family: var(--font);
  background: #f4f9fb;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── HEADER ─────────────────────────────────────────────── */
.site-header {
  background: var(--brand);
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 68px;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  position: relative;
}

.logo {
  height: 42px;
  width: auto;
  object-fit: contain;
}

.site-title {
  color: var(--white);
  font-size: 2.00rem;
  font-weight: 700;
  letter-spacing: .3px;
  white-space: nowrap;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

/* ── MAIN ────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  max-width: 1600px;
  width: 100%;
  margin: 2rem auto;
  padding: 0 2rem 3rem;
}

/* ── TOOLBAR ─────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: -.3px;
}

.record-count {
  font-size: .82rem;
  font-weight: 600;
  color: var(--white);
  background: var(--brand);
  border-radius: 20px;
  padding: .15rem .65rem;
}

/* ── DATE BADGE ──────────────────────────────────────────── */
.date-badge {
  font-size: .78rem;
  font-weight: 600;
  color: var(--brand-dark);
  background: var(--brand-light);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: .2rem .75rem;
  white-space: nowrap;
}

/* ── TOOLBAR RIGHT ───────────────────────────────────────── */
.toolbar-right {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-wrap: wrap;
}

/* ── SEARCH ──────────────────────────────────────────────── */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: .65rem;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  padding: .5rem .9rem .5rem 2rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .85rem;
  width: 260px;
  outline: none;
  background: var(--white);
  transition: border-color .18s, box-shadow .18s;
}

.search-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(1,100,129,.12);
}

/* ── DOWNLOAD BUTTON ─────────────────────────────────────── */
.btn-download {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: var(--brand);
  color: var(--white);
  font-size: .88rem;
  font-weight: 600;
  text-decoration: none;
  padding: .55rem 1.25rem;
  border-radius: var(--radius);
  border: 2px solid var(--brand);
  transition: background .18s, color .18s, transform .12s;
  box-shadow: 0 2px 6px rgba(1,100,129,.25);
  white-space: nowrap;
}

.btn-download:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(1,100,129,.3);
}

.btn-download:active { transform: translateY(0); }

/* ── META BAR ────────────────────────────────────────────── */
.meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: .75rem;
  font-size: .83rem;
  color: var(--text-muted);
}

.meta-bar-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2.5rem;
}

.page-size-label {
  display: flex;
  align-items: center;
  gap: .4rem;
}

.page-size-select {
  padding: .25rem .5rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: .83rem;
  background: var(--white);
  outline: none;
  cursor: pointer;
}

.page-info { font-size: .83rem; }

/* ── DATE RANGE FILTER ───────────────────────────────────── */
.date-filter-group {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}

.date-filter-title {
  font-size: .83rem;
  font-weight: 700;
  color: var(--brand);
  white-space: nowrap;
}

.date-filter-label {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .83rem;
  color: var(--text-muted);
  font-weight: 600;
}

.date-input {
  padding: .35rem .55rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: .82rem;
  background: var(--white);
  color: var(--text);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}

.date-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(1,100,129,.12);
}

.btn-apply {
  background: var(--brand-dark);
  color: var(--white);
  font-size: .82rem;
  font-weight: 600;
  border: 2px solid var(--brand-dark);
  border-radius: 6px;
  padding: .38rem 1rem;
  cursor: pointer;
  transition: background .18s, transform .12s;
}

.btn-apply:hover {
  background: #013a4c;
  border-color: #013a4c;
  transform: translateY(-1px);
}

.btn-apply:active { transform: translateY(0); }

.btn-reset {
  display: inline-flex;
  align-items: center;
  background: var(--white);
  color: var(--brand-dark);
  font-size: .82rem;
  font-weight: 600;
  border: 2px solid var(--border);
  border-radius: 6px;
  padding: .35rem 1rem;
  cursor: pointer;
  text-decoration: none;
  transition: background .18s, border-color .18s, color .18s, transform .12s;
}

.btn-reset:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #b91c1c;
  transform: translateY(-1px);
}

.btn-reset:active { transform: translateY(0); }

/* ── ERROR ALERT ─────────────────────────────────────────── */
.alert-error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #b91c1c;
  border-radius: var(--radius);
  padding: .9rem 1.2rem;
  margin-bottom: 1.2rem;
  font-size: .88rem;
}

/* ── TABLE WRAPPER ───────────────────────────────────────── */
.table-wrapper {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: auto;
  border: 1px solid var(--border);
  max-height: calc(100vh - 220px);
  min-height: 400px;
}

/* ── DATA TABLE ──────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
  white-space: nowrap;
}

.data-table thead {
  background: var(--brand);
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table thead th {
  padding: .75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: .78rem;
  letter-spacing: .4px;
  text-transform: uppercase;
  border-right: 1px solid rgba(255,255,255,.12);
  user-select: none;
  cursor: pointer;
  white-space: nowrap;
}

.data-table thead th:last-child { border-right: none; }
.data-table thead th:hover { background: var(--brand-dark); }

.sort-arrow {
  margin-left: .35rem;
  font-size: .7rem;
  opacity: .7;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}

.data-table tbody tr:nth-child(even) { background: var(--row-alt); }
.data-table tbody tr:hover { background: var(--brand-light); }

.data-table tbody td {
  padding: .65rem 1rem;
  color: var(--text);
  border-right: 1px solid var(--border);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table tbody td:last-child { border-right: none; }

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem !important;
  color: var(--text-muted);
  font-size: .9rem;
  font-style: italic;
}

/* ── PAGINATION ──────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: 1.25rem;
}

.page-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 .55rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  color: var(--brand);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.page-btn:hover:not(:disabled) {
  background: var(--brand);
  color: var(--white);
  border-color: var(--brand);
}

.page-btn.active {
  background: var(--brand);
  color: var(--white);
  border-color: var(--brand);
  pointer-events: none;
}

.page-btn:disabled { opacity: .35; cursor: default; }

.page-ellipsis {
  font-size: .82rem;
  color: var(--text-muted);
  padding: 0 .25rem;
  line-height: 34px;
}

/* ── FOOTER ──────────────────────────────────────────────── */
.site-footer {
  background: var(--brand);
  color: rgba(255,255,255,.7);
  text-align: center;
  padding: 1rem;
  font-size: .78rem;
  margin-top: auto;
}

/* ── SCROLLBAR ───────────────────────────────────────────── */
.table-wrapper::-webkit-scrollbar { height: 6px; width: 6px; }
.table-wrapper::-webkit-scrollbar-track { background: #f0f4f6; }
.table-wrapper::-webkit-scrollbar-thumb { background: var(--brand); border-radius: 3px; }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .header-inner  { padding: 0 1rem; }
  .main-content  { padding: 0 1rem 2rem; }
  .page-title    { font-size: 1.15rem; }
  .search-input  { width: 180px; }
  .toolbar-right { gap: .45rem; }
  .meta-bar-left { flex-direction: column; align-items: flex-start; gap: .6rem; }
  .date-filter-group { width: 100%; }
}
/* ── LOGIN ───────────────────────────────────────────────── */
.login-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  display: flex;
  flex-direction: column;
}

.login-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--brand);
}

.login-sub {
  font-size: .85rem;
  color: var(--text-muted);
  margin: .25rem 0 1.25rem;
}

.login-label {
  font-size: .83rem;
  font-weight: 600;
  margin-bottom: .35rem;
}

.login-input {
  padding: .6rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .9rem;
  margin-bottom: 1rem;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}

.login-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(1,100,129,.12);
}

.login-btn {
  justify-content: center;
  border: none;
  cursor: pointer;
  font-family: inherit;
  margin-top: .25rem;
}

/* ── HEADER USER / LOGOUT ────────────────────────────────── */
.header-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--white);
  font-size: .85rem;
}

.btn-logout {
  color: var(--white);
  text-decoration: none;
  font-weight: 600;
  border: 1.5px solid rgba(255,255,255,.6);
  border-radius: var(--radius);
  padding: .3rem .85rem;
  transition: background .18s;
}

.btn-logout:hover { background: rgba(255,255,255,.15); }
