:root {
  --navy-900: #0b1a3a;
  --navy-800: #11285c;
  --navy-700: #1a3a7a;
  --gold-500: #e8a91d;
  --gold-400: #f6c94e;
  --bg: #f3f5fa;
  --surface: #ffffff;
  --text: #17203a;
  --muted: #5d6784;
  --border: #d4dbea;
  --success: #08825a;
  --danger: #c22f2f;
  --warning: #b8860b;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.hidden { display: none !important; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: linear-gradient(90deg, var(--navy-900), var(--navy-700));
  color: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,.12);
}

.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; }
.brand img { width: 32px; height: 32px; object-fit: contain; }
.brand strong { color: var(--gold-400); font-weight: 800; }

.auth { display: flex; align-items: center; gap: 8px; }
.auth input {
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.1);
  color: #fff;
  min-width: 220px;
}
.auth input::placeholder { color: rgba(255,255,255,.6); }
.auth button, button {
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

button.primary { background: var(--gold-500); color: #2d2103; }
button.secondary { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25); }
button.success { background: var(--success); color: #fff; }
button.danger { background: var(--danger); color: #fff; }
button.warning { background: #f6c94e; color: #2d2103; }
button.small { padding: 5px 10px; font-size: 12px; }

.container { max-width: 1200px; margin: 0 auto; padding: 32px 24px; }

.login-panel {
  max-width: 420px;
  margin: 80px auto;
  background: var(--surface);
  border-radius: 18px;
  padding: 36px;
  box-shadow: 0 8px 30px rgba(0,0,0,.08);
  text-align: center;
}
.login-logo { width: 72px; height: 72px; margin-bottom: 16px; }
.login-panel h1 { margin: 0 0 8px; font-size: 24px; }
.login-panel p { margin: 0 0 24px; color: var(--muted); }
.login-panel label { display: block; text-align: left; font-size: 12px; font-weight: 800; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.login-panel input {
  width: 100%;
  padding: 11px 12px;
  margin-bottom: 16px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
}
.login-panel button { width: 100%; padding: 12px; font-size: 16px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 14px; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat {
  background: var(--surface);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 2px 10px rgba(0,0,0,.04);
}
.stat b { display: block; font-size: 26px; color: var(--navy-700); }
.stat span { font-size: 13px; color: var(--muted); font-weight: 700; text-transform: uppercase; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  background: var(--surface);
  padding: 16px;
  border-radius: 14px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,.04);
}
.filters label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 800; text-transform: uppercase; color: var(--muted); }
.filters select, .filters input {
  padding: 9px 11px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  min-width: 160px;
  font-size: 14px;
}

.requests-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,.04);
}
.requests-table th, .requests-table td { padding: 14px 16px; text-align: left; font-size: 13px; }
.requests-table thead { background: var(--navy-800); color: #fff; }
.requests-table thead th { font-weight: 700; text-transform: uppercase; font-size: 11px; letter-spacing: .5px; }
.requests-table tbody tr { border-bottom: 1px solid var(--border); }
.requests-table tbody tr:hover { background: #f8f9fc; }
.requests-table td { vertical-align: middle; }
.requests-table .empty { text-align: center; color: var(--muted); padding: 40px; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.status.pending { background: #fff8e8; color: #8a6d0b; }
.status.pending::before { background: var(--warning); }
.status.printed { background: #e6f7f0; color: var(--success); }
.status.printed::before { background: var(--success); }
.status.failed { background: #fdecec; color: var(--danger); }
.status.failed::before { background: var(--danger); }

.actions { display: flex; gap: 6px; flex-wrap: wrap; }

.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--navy-900);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  opacity: 0;
  transform: translateY(10px);
  transition: .25s;
  pointer-events: none;
  max-width: 340px;
}
.toast.show { opacity: 1; transform: translateY(0); }

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
}
.tab {
  padding: 12px 18px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  border-radius: 10px 10px 0 0;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}
.tab.active { background: var(--surface); color: var(--navy-900); border-bottom-color: var(--gold-500); }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.panel-header h2 { margin: 0; font-size: 20px; }

.create-form {
  background: var(--surface);
  padding: 20px;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,.04);
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.create-form h3 { grid-column: 1 / -1; margin: 0 0 4px; font-size: 16px; }
.create-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 800; text-transform: uppercase; color: var(--muted); }
.create-form input {
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  font-size: 14px;
}
.form-actions { grid-column: 1 / -1; display: flex; gap: 10px; }

.instances-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,.04);
}
.instances-table th, .instances-table td { padding: 14px 16px; text-align: left; font-size: 13px; }
.instances-table thead { background: var(--navy-800); color: #fff; }
.instances-table thead th { font-weight: 700; text-transform: uppercase; font-size: 11px; letter-spacing: .5px; }
.instances-table tbody tr { border-bottom: 1px solid var(--border); }
.instances-table tbody tr:hover { background: #f8f9fc; }
.instances-table td { vertical-align: middle; }
.instances-table .empty { text-align: center; color: var(--muted); padding: 40px; }
.instances-table code {
  display: inline-block;
  background: #f0f2f7;
  padding: 3px 7px;
  border-radius: 6px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: #3a4154;
  margin-right: 6px;
}
.status.active { background: #e6f7f0; color: var(--success); }
.status.active::before { background: var(--success); }
.status.blocked { background: #fdecec; color: var(--danger); }
.status.blocked::before { background: var(--danger); }

@media (max-width: 760px) {
  .requests-table thead { display: none; }
  .requests-table tbody tr { display: block; padding: 14px; }
  .requests-table td { display: flex; justify-content: space-between; padding: 6px 0; }
  .requests-table td::before { content: attr(data-label); font-weight: 800; color: var(--muted); }
  .requests-table .actions { justify-content: flex-end; }
}
