:root {
  --primary: #801419;
  --primary2: #a31b21;
  --bg: #FCFBF7;
  --card: #FFFFFF;
  --text: #1A2238;
  --muted: #52607A;
  --line: #DCEEF8;
  --success: #0f9d6e;
  --danger: #dc4c64;
  --warning: #F4A300;
  --shadow: 0 12px 35px rgba(26, 34, 56, 0.06);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

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

.sidebar {
  width: 255px;
  background: var(--text);
  color: #cbd5e1;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 30;
  box-shadow: 10px 0 30px rgba(15, 23, 42, 0.12);
}

.brand {
  height: 78px;
  padding: 16px 18px;
  display: flex;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--warning), var(--primary));
  color: white;
  font-weight: 800;
}

.brand strong {
  display: block;
  color: #fff;
  font-size: 15px;
}

.brand small {
  display: block;
  color: #94a3b8;
  margin-top: 3px;
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-nav {
  padding: 15px 11px;
  overflow: auto;
}

.nav-label {
  font-size: 10px;
  letter-spacing: .14em;
  color: #64748b;
  font-weight: 700;
  padding: 10px 12px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #cbd5e1;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  margin: 2px 0;
  font-weight: 600;
  transition: background 0.15s, transform 0.15s, color 0.15s;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  transform: translateX(2px);
}

.nav-link.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-left: 3px solid var(--warning);
}

.nav-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

.sidebar-bottom {
  margin-top: auto;
  padding: 12px;
}

.support-box {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 10px;
}

.support-box span,
.support-box small {
  display: block;
  color: #94a3b8;
  font-size: 11px;
}

.support-box strong {
  display: block;
  color: #fff;
  margin: 3px 0;
}

.logout {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 0;
}

.main-area {
  margin-left: 255px;
  width: calc(100% - 255px);
  min-width: 0;
}

.topbar {
  height: 78px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h1 {
  font-size: 21px;
  margin: 2px 0 0;
}

.eyebrow {
  font-size: 10px;
  letter-spacing: .12em;
  color: #9aa2b1;
  font-weight: 800;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.session-chip {
  background: var(--line);
  color: var(--primary);
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 9px;
}

.user-chip {
  display: flex;
  gap: 9px;
  align-items: center;
}

.user-chip small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--line);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-weight: 800;
}

.content {
  padding: 26px;
  max-width: 1500px;
  margin: auto;
}

.mobile-menu {
  display: none;
  border: 0;
  background: #f3f4f6;
  border-radius: 9px;
  padding: 8px 10px;
  cursor: pointer;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.stat {
  padding: 18px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s, transform 0.15s;
}

.stat:hover {
  box-shadow: 0 16px 42px rgba(31, 41, 55, 0.08);
  transform: translateY(-1px);
}

.stat-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--line);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-size: 19px;
}

.stat .label {
  color: var(--muted);
  font-weight: 600;
}

.stat .value {
  font-size: 25px;
  font-weight: 800;
  margin: 10px 0 5px;
}

.stat .hint {
  font-size: 11px;
  color: #8a93a3;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  transition: box-shadow 0.15s, transform 0.15s;
}

.card:hover {
  box-shadow: 0 16px 42px rgba(31, 41, 55, 0.08);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-bottom: 16px;
}

.section-head h2,
.card h2 {
  font-size: 17px;
  margin: 0;
}

.section-head p {
  color: var(--muted);
  margin: 4px 0 0;
  font-size: 12px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

@media(min-width: 900px) {
  .grid-2 {
    grid-template-columns: 1.5fr 1fr;
  }
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  background: #f8fafc;
  color: #667085;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 13px 12px;
  border-bottom: 1px solid #eef0f5;
  vertical-align: middle;
  white-space: nowrap;
}

td.wrap, th.wrap {
  white-space: normal;
}

tr:hover td {
  background: #fbfcff;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 700;
}

.badge.success {
  background: #e9f8f2;
  color: #087a56;
}

.badge.warning {
  background: #fff4df;
  color: #a05f00;
}

.badge.danger {
  background: #fdebed;
  color: #b72f49;
}

.badge.info {
  background: var(--line);
  color: var(--primary);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: 10px;
  padding: 9px 13px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.12s, filter 0.12s;
}

.btn:hover {
  filter: brightness(.96);
}

.btn:active {
  transform: translateY(1px);
}

.btn.secondary {
  background: var(--line);
  color: var(--primary);
}

.btn.ghost {
  background: #f3f4f6;
  color: #374151;
}

.btn.danger {
  background: #fee2e2;
  color: #b91c1c;
}

.btn.success {
  background: #dcfce7;
  color: #166534;
}

.btn.small {
  padding: 7px 9px;
  font-size: 11px;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.toolbar .search {
  flex: 1;
  max-width: 430px;
}

.search {
  position: relative;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #dfe3eb;
  background: #fff;
  color: #1f2937;
  border-radius: 10px;
  padding: 10px 11px;
  outline: none;
  font: inherit;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(128, 20, 25, 0.15);
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
}

.form-grid.two {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 7px;
  color: #475467;
}

.field.full {
  grid-column: 1 / -1;
}

.form-actions {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

.alert {
  padding: 12px 15px;
  border-radius: 11px;
  margin-bottom: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.alert button {
  border: 0;
  background: transparent;
  font-size: 20px;
  color: inherit;
  cursor: pointer;
}

.alert.success {
  background: #e9f8f2;
  color: #087a56;
}

.alert.error {
  background: #fdebed;
  color: #b72f49;
}

.profile {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 22px;
}

.profile-photo {
  width: 180px;
  height: 210px;
  border-radius: 14px;
  background: #f1f3f7;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
}

.profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.info-item {
  padding: 12px;
  background: #f8fafc;
  border-radius: 11px;
}

.info-item span {
  display: block;
  color: #8a93a3;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
}

.info-item strong {
  display: block;
  margin-top: 5px;
}

.mini-list {
  display: flex;
  flex-direction: column;
}

.mini-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.mini-item:last-child {
  border-bottom: 0;
}

.progress {
  height: 7px;
  background: #edf0f5;
  border-radius: 99px;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--warning));
}

.notice {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  margin-bottom: 10px;
}

.notice h3 {
  margin: 0 0 5px;
  font-size: 14px;
}

.notice p {
  margin: 0;
  color: #667085;
  line-height: 1.55;
}

.notice-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 11px;
  color: #98a2b3;
}

.empty {
  padding: 45px 20px;
  text-align: center;
  color: #8a93a3;
}

.empty strong {
  display: block;
  color: #475467;
  margin-bottom: 5px;
}

.empty:before {
  content: '⌁';
  display: block;
  font-size: 28px;
  margin-bottom: 7px;
  color: #c5cad5;
}

.pill-tabs {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.pill-tabs a {
  padding: 8px 11px;
  border-radius: 9px;
  background: #f3f4f6;
  color: #4b5563;
  text-decoration: none;
  font-weight: 700;
  font-size: 12px;
}

.pill-tabs a.active {
  background: var(--line);
  color: var(--primary);
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
}

.kpi {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.kpi small {
  display: block;
  color: var(--muted);
}

.kpi strong {
  font-size: 19px;
  display: block;
  margin-top: 3px;
}

.routine-table th,
.routine-table td {
  text-align: center;
}

.routine-table th:first-child,
.routine-table td:first-child {
  text-align: left;
}

.routine-cell {
  min-width: 115px;
}

.routine-cell strong {
  display: block;
}

.routine-cell small {
  color: #8b93a2;
}

.print-sheet {
  background: #fff;
  border: 1px solid #ddd;
  max-width: 850px;
  margin: auto;
  padding: 35px;
  box-shadow: var(--shadow);
}

.print-head {
  text-align: center;
  border-bottom: 2px solid #222;
  padding-bottom: 14px;
  margin-bottom: 18px;
}

.print-head img {
  max-width: 75px;
  max-height: 75px;
}

.print-head h2 {
  margin: 6px 0;
}

.receipt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 15px;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed #ddd;
  padding: 8px 0;
}

.id-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.id-card {
  border: 1px solid #d9dce5;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .06);
}

.id-card-head {
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: #fff;
  padding: 12px;
  text-align: center;
}

.id-card-body {
  padding: 15px;
  text-align: center;
}

.id-photo {
  width: 85px;
  height: 100px;
  border-radius: 9px;
  object-fit: cover;
  background: #eef0f5;
  margin: 2px auto 10px;
  display: block;
}

.id-card-body h3 {
  margin: 4px 0;
}

.id-card-body p {
  margin: 4px;
  color: #667085;
  font-size: 11px;
}

.app-frame {
  width: 340px;
  max-width: 100%;
  margin: auto;
  border: 8px solid #111827;
  border-radius: 32px;
  background: #f8fafc;
  overflow: hidden;
  box-shadow: 0 25px 50px rgba(15, 23, 42, 0.18);
}

.app-notch {
  height: 25px;
  background: #111827;
}

.app-screen {
  padding: 18px;
}

.app-screen .app-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.app-menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.app-tile {
  background: #fff;
  border: 1px solid var(--line);
  padding: 14px;
  border-radius: 13px;
  font-weight: 700;
}

.footer {
  text-align: center;
  color: #9aa2b1;
  font-size: 11px;
  padding: 24px;
}

.hide {
  display: none;
}

html {
  scroll-behavior: smooth;
}

.page-intro {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 20px;
}

.page-intro h2 {
  font-size: 24px;
  margin: 0 0 5px;
}

.page-intro p {
  margin: 0;
  color: var(--muted);
}

.top-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.capacity {
  margin-top: 18px;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.capacity>div:first-child {
  display: flex;
  justify-content: space-between;
  margin-bottom: 9px;
  color: var(--muted);
}

.capacity strong {
  color: var(--text);
}

.flow {
  display: grid;
  gap: 8px;
}

.flow a {
  display: grid;
  grid-template-columns: 34px 1fr 20px;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fbfcff;
  transition: border-color 0.15s, background 0.15s;
}

.flow a:hover {
  border-color: var(--primary);
  background: #f7f7ff;
}

.flow b {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--line);
  color: var(--primary);
  font-size: 11px;
}

.flow span {
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

.danger-text {
  color: var(--danger);
}

.success-text {
  color: var(--success);
}

@media(max-width: 900px) {
  .id-card-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

@media(max-width: 780px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease-in-out;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-area {
    margin-left: 0;
    width: 100%;
  }
  .mobile-menu {
    display: block;
  }
  .topbar {
    padding: 0 16px;
    height: 70px;
  }
  .top-actions .session-chip {
    display: none;
  }
  .user-chip div {
    display: none;
  }
  .content {
    padding: 16px;
    padding-top: 18px;
  }
  .page-intro {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }
  .page-intro .actions {
    width: 100%;
  }
  .page-intro .btn {
    flex: 1;
  }
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .search {
    max-width: none;
  }
  .topbar h1 {
    font-size: 18px;
  }
}

@media print {
  .sidebar,
  .topbar,
  .footer,
  .no-print {
    display: none !important;
  }
  .main-area {
    margin: 0;
    width: 100%;
  }
  .content {
    padding: 0;
  }
  .print-sheet {
    box-shadow: none;
    border: 0;
    max-width: none;
  }
  .id-card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
