@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --nasd-red:    #C0202A;
  --nasd-navy:   #1A2B5F;
  --nasd-blue:   #1565C0;
  --accent:      #0D47A1;
  --bg:          #F4F6FA;
  --surface:     #FFFFFF;
  --border:      #DDE3EF;
  --text-main:   #1A1F2E;
  --text-muted:  #6B7A99;
  --success:     #1B8C4A;
  --error:       #C0202A;
  --row-hover:   #EEF2FB;
  --shadow-sm:   0 1px 4px rgba(26,43,95,0.08);
  --shadow-md:   0 4px 20px rgba(26,43,95,0.12);
  --radius:      8px;
  --font:        'IBM Plex Sans', sans-serif;
  --mono:        'IBM Plex Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

/* ── NAV ─────────────────────────────────────── */
.navbar {
  background: var(--surface);
  border-bottom: 2px solid var(--nasd-red);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 72px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.nav-brand img { height: 44px; }

.nav-brand-text {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  line-height: 1.3;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .875rem;
  color: var(--text-muted);
  font-weight: 500;
}

.nav-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--nasd-navy);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .875rem; font-weight: 700;
  position: relative;
}

.nav-avatar::after {
  content: '';
  position: absolute;
  bottom: 1px; right: 1px;
  width: 9px; height: 9px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid var(--surface);
}

.nav-link {
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 6px 14px;
  border-radius: var(--radius);
  transition: background .15s, color .15s;
  color: var(--nasd-navy);
}
.nav-link:hover { background: var(--row-hover); }
.nav-link.danger { color: var(--nasd-red); }

/* ── LAYOUT ──────────────────────────────────── */
.main-wrap {
  flex: 1;
  max-width: 1100px;
  margin: 2.5rem auto;
  padding: 0 1.5rem;
  width: 100%;
}

.page-header {
  margin-bottom: 1.8rem;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--nasd-navy);
  letter-spacing: -.01em;
}

.page-subtitle {
  font-size: .875rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── CARD ─────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* ── TOOLBAR ──────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
  flex-wrap: wrap;
}

.toolbar-left { display: flex; gap: .5rem; flex-wrap: wrap; }

.btn-export {
  font-size: .78rem;
  font-weight: 600;
  font-family: var(--font);
  padding: 6px 14px;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  background: var(--nasd-blue);
  color: #fff;
  letter-spacing: .04em;
}
.btn-export:hover { opacity: .88; transform: translateY(-1px); }

.search-wrap { display: flex; align-items: center; gap: 8px; }
.search-wrap label { font-size: .8rem; color: var(--text-muted); font-weight: 500; }
.search-wrap input {
  font-family: var(--font);
  font-size: .83rem;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  outline: none;
  width: 200px;
  transition: border .15s;
}
.search-wrap input:focus { border-color: var(--nasd-blue); }

/* ── TABLE ────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }

.data-table thead th {
  text-align: left;
  padding: 12px 1.25rem;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: #FAFBFD;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.data-table thead th .sort-icon { margin-left: 4px; opacity: .4; }
.data-table thead th.sorted .sort-icon { opacity: 1; color: var(--nasd-blue); }

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

.data-table td {
  padding: 14px 1.25rem;
  font-size: .875rem;
  vertical-align: middle;
}

.doc-name {
  font-weight: 600;
  color: var(--text-main);
}

.date-cell { color: var(--text-muted); font-family: var(--mono); font-size: .8rem; }
.size-cell { color: var(--text-muted); font-size: .8rem; }
.sn-cell   { color: var(--text-muted); font-weight: 500; }

/* ── DOWNLOAD BUTTON ──────────────────────────── */
.btn-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 6px;
  background: var(--nasd-blue);
  color: #fff;
  text-decoration: none;
  transition: background .15s, transform .1s, box-shadow .1s;
  border: none;
  cursor: pointer;
}
.btn-download:hover {
  background: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(13,71,161,.25);
}
.btn-download svg { width: 16px; height: 16px; }

.btn-download.unavailable {
  background: var(--border);
  cursor: not-allowed;
  color: var(--text-muted);
}
.btn-download.unavailable:hover { transform: none; box-shadow: none; }

/* ── PAGINATION ───────────────────────────────── */
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 1.25rem;
  border-top: 1px solid var(--border);
  font-size: .8rem;
  color: var(--text-muted);
  background: #FAFBFD;
  flex-wrap: wrap;
  gap: .75rem;
}

.pagination { display: flex; gap: 4px; }
.pg-btn {
  width: 30px; height: 30px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: .78rem; font-weight: 600;
  color: var(--nasd-navy);
  transition: background .12s, color .12s;
  font-family: var(--font);
}
.pg-btn:hover, .pg-btn.active {
  background: var(--nasd-blue); color: #fff; border-color: var(--nasd-blue);
}

/* ── FLASH ────────────────────────────────────── */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  font-size: .875rem;
  font-weight: 500;
}
.flash-success { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.flash-error   { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }

/* ── AUTH ─────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--nasd-navy) 0%, #2D4A9A 100%);
  padding: 2rem;
}

.auth-box {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
}

.auth-header {
  background: var(--nasd-navy);
  padding: 2rem;
  text-align: center;
  border-bottom: 3px solid var(--nasd-red);
}

.auth-header img { height: 52px; margin-bottom: 1rem; }
.auth-header h2 { color: #fff; font-size: 1rem; font-weight: 500; letter-spacing: .05em; }
.auth-header p  { color: rgba(255,255,255,.55); font-size: .78rem; margin-top: 4px; }

.auth-body { padding: 2rem; }

.form-group { margin-bottom: 1.1rem; }

.form-group label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group input,
.form-group select {
  width: 100%;
  font-family: var(--font);
  font-size: .875rem;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  transition: border .15s, box-shadow .15s;
  color: var(--text-main);
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--nasd-blue);
  box-shadow: 0 0 0 3px rgba(21,101,192,.12);
}

.btn-primary {
  width: 100%;
  padding: 11px;
  background: var(--nasd-blue);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-family: var(--font);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: .04em;
  transition: background .15s, transform .1s;
  margin-top: .5rem;
}
.btn-primary:hover { background: var(--accent); transform: translateY(-1px); }

/* ── ADMIN TABLE ──────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.badge-admin { background: #FEF3C7; color: #92400E; }
.badge-user  { background: #EFF6FF; color: #1E40AF; }
.badge-active   { background: #ECFDF5; color: #065F46; }
.badge-inactive { background: #FEF2F2; color: #991B1B; }

.action-btns { display: flex; gap: 6px; }

.btn-sm {
  font-size: .75rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  text-decoration: none;
  display: inline-flex; align-items: center;
  transition: opacity .15s;
}
.btn-sm:hover { opacity: .82; }
.btn-edit    { background: #EFF6FF; color: #1E40AF; }
.btn-toggle  { background: #FEF3C7; color: #92400E; }
.btn-delete  { background: #FEF2F2; color: #991B1B; }
.btn-green   { background: var(--nasd-blue); color: #fff; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.card-header-title { font-size: 1rem; font-weight: 700; color: var(--nasd-navy); }

/* ── MODAL ────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal-box {
  background: var(--surface);
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
  animation: slideUp .2s ease;
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700; color: var(--nasd-navy);
}
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 1.2rem; line-height: 1;
}
.modal-body { padding: 1.25rem; }

/* ── FOOTER ───────────────────────────────────── */
footer {
  text-align: center;
  padding: 1.25rem;
  font-size: .76rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ── RESPONSIVE ───────────────────────────────── */
@media (max-width: 640px) {
  .navbar { padding: 0 1rem; }
  .nav-user span { display: none; }
  .main-wrap { margin: 1.25rem auto; padding: 0 1rem; }
  .toolbar { flex-direction: column; align-items: flex-start; }
  .search-wrap input { width: 160px; }
}
