/* ==========================================================
   Production Register Portal
   Design note: a nod to the physical ledger book this digitizes -
   ink-blue ruling, paper tones, tabular numerals for figures -
   without literally imitating notebook paper.
   ========================================================== */

:root {
  --ink:        #1e2a38;
  --ink-soft:   #33475a;
  --paper:      #f6f4ee;
  --paper-card: #ffffff;
  --rule:       #d8d2c4;
  --rule-red:   #c0524a;
  --accent:     #b5652c;
  --accent-dark:#8f4e20;
  --ok:         #2f7a4f;
  --ok-bg:      #e7f3ea;
  --warn-bg:    #fbeee0;
  --warn-text:  #8a5a1c;
  --error-bg:   #fbeaea;
  --error-text: #a02f2a;
  --font-display: 'Georgia', 'Iowan Old Style', serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-num: 'Consolas', 'SFMono-Regular', Menlo, monospace;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(30,42,56,0.08), 0 1px 2px rgba(30,42,56,0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-family: var(--font-display); color: var(--ink); margin: 0 0 0.5em; }

/* ---------------- Auth pages ---------------- */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--ink) 0%, var(--ink-soft) 100%);
}
.auth-card {
  background: var(--paper-card);
  border-radius: var(--radius);
  padding: 2.5rem 2.25rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  border-top: 4px solid var(--accent);
}
.auth-card h1 { font-size: 1.4rem; margin-bottom: 0.15em; }
.auth-subtitle { color: var(--ink-soft); margin: 0 0 1.5rem; font-size: 0.9rem; }
.auth-footer { margin-top: 1.25rem; font-size: 0.78rem; color: var(--ink-soft); text-align: center; }
.auth-footer code { background: var(--paper); padding: 1px 5px; border-radius: 3px; }

/* ---------------- Forms ---------------- */
label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); margin: 1rem 0 0.3rem; }
input, select, textarea {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(181,101,44,0.15);
}
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row > div { flex: 1; min-width: 180px; }
.form-actions { margin-top: 1.5rem; display: flex; gap: 0.75rem; }
.help-text { font-size: 0.78rem; color: var(--ink-soft); margin-top: 0.25rem; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); text-decoration: none; }
.btn-outline { background: transparent; border-color: var(--rule); color: var(--ink); }
.btn-outline:hover { border-color: var(--accent); text-decoration: none; }
.btn-danger { background: var(--error-text); color: #fff; }
.btn-danger:hover { opacity: 0.9; text-decoration: none; }
.btn-sm { padding: 0.32rem 0.7rem; font-size: 0.78rem; }
.btn-block { width: 100%; margin-top: 1.5rem; }

/* ---------------- Alerts ---------------- */
.alert { padding: 0.7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.88rem; }
.alert-success { background: var(--ok-bg); color: var(--ok); }
.alert-warning { background: var(--warn-bg); color: var(--warn-text); }
.alert-error   { background: var(--error-bg); color: var(--error-text); }

/* ---------------- App shell ---------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 230px;
  background: var(--ink);
  color: #dfe6ee;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.sidebar-brand {
  padding: 1.3rem 1.2rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.brand-icon { color: var(--accent); }
.sidebar-nav { padding: 0.75rem 0; display: flex; flex-direction: column; }
.sidebar-nav a {
  color: #b9c4d0;
  padding: 0.65rem 1.2rem;
  font-size: 0.88rem;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.05); text-decoration: none; color: #fff; }
.sidebar-nav a.active { color: #fff; border-left-color: var(--accent); background: rgba(255,255,255,0.06); font-weight: 600; }

.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  background: var(--paper-card);
  border-bottom: 1px solid var(--rule);
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.topbar-title { font-family: var(--font-display); font-size: 1.15rem; flex: 1; }
.topbar-user { display: flex; align-items: center; gap: 0.75rem; font-size: 0.85rem; color: var(--ink-soft); }
.icon-btn { background: none; border: none; font-size: 1.3rem; cursor: pointer; display: none; color: var(--ink); }

.content { padding: 1.5rem; flex: 1; }
.app-footer { padding: 1rem 1.5rem; font-size: 0.75rem; color: var(--ink-soft); text-align: center; border-top: 1px solid var(--rule); }

/* ---------------- Cards / panels ---------------- */
.card {
  background: var(--paper-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.5rem;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; flex-wrap: wrap; gap: 0.75rem; }
.card-header h2 { font-size: 1.05rem; margin: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--paper-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.3rem;
  border-left: 4px solid var(--accent);
}
.stat-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); }
.stat-value { font-family: var(--font-num); font-size: 1.6rem; font-weight: 700; color: var(--ink); margin-top: 0.2rem; }

/* ---------------- Tables (the register itself) ---------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); }
table.register {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper-card);
  font-size: 0.88rem;
}
table.register thead th {
  background: var(--ink);
  color: #fff;
  text-align: left;
  padding: 0.65rem 0.8rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
table.register tbody td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
table.register tbody tr:hover { background: #faf8f2; }
table.register td.num, table.register th.num { text-align: right; font-family: var(--font-num); }
table.register tfoot td {
  padding: 0.7rem 0.8rem;
  font-weight: 700;
  border-top: 2px solid var(--ink);
  font-family: var(--font-num);
  background: #faf7ef;
}
.row-actions { display: flex; gap: 0.5rem; }
.badge { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.72rem; font-weight: 600; }
.badge-admin { background: #e6ecf5; color: #3b5998; }
.badge-staff { background: var(--ok-bg); color: var(--ok); }
.badge-inactive { background: var(--error-bg); color: var(--error-text); }

/* ---------------- Filters bar ---------------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; margin-bottom: 1.25rem; }
.filter-bar > div { min-width: 150px; }
.filter-bar label { margin: 0 0 0.3rem; }

/* ---------------- Advanced search (collapsible) ---------------- */
.adv-search {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  margin-bottom: 1.25rem;
  background: #faf8f2;
}
.adv-search summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.adv-search summary::-webkit-details-marker { display: none; }
.adv-search summary::before {
  content: '\25B8';
  display: inline-block;
  transition: transform 0.15s ease;
  color: var(--accent);
}
.adv-search[open] summary::before { transform: rotate(90deg); }
.adv-search[open] { background: #fff; }

/* ---------------- Pagination ---------------- */
.pagination { display: flex; gap: 0.4rem; margin-top: 1rem; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font-size: 0.82rem;
  color: var(--ink);
}
.pagination a:hover { border-color: var(--accent); text-decoration: none; }
.pagination .current { background: var(--ink); color: #fff; border-color: var(--ink); }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--ink-soft); }
.empty-state .big { font-size: 2rem; margin-bottom: 0.5rem; }

/* ---------------- Print (used for PDF export via browser print) ---------------- */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; }
}

/* ---------------- Responsive ---------------- */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: -230px; top: 0; bottom: 0; z-index: 50; transition: left 0.2s ease; }
  .sidebar.open { left: 0; }
  .icon-btn { display: inline-block; }
}
