:root {
  --blue: #1677ff;
  --blue-dark: #0f5fd7;
  --navy: #102b52;
  --navy-deep: #0b2345;
  --ink: #172033;
  --muted: #6f7b91;
  --line: #e5eaf2;
  --page: #f4f7fb;
  --surface: #ffffff;
  --green: #10b981;
  --orange: #f59e0b;
  --red: #ef4444;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 1180px;
  min-height: 100%;
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: sans-serif;
  font-size: 14px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.is-hidden {
  display: none !important;
}

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background: #ecf2f9;
}

.login-panel {
  width: 430px;
  padding: 38px;
  border: 1px solid rgba(23, 32, 51, 0.06);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(17, 43, 78, 0.14);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: #ffffff;
  border-radius: 8px;
  background: var(--blue);
  font-size: 19px;
  font-weight: 800;
}

.login-brand strong,
.login-brand span {
  display: block;
}

.login-brand strong {
  font-size: 17px;
}

.login-brand span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.login-panel h1 {
  margin: 34px 0 8px;
  font-size: 28px;
}

.login-panel > p {
  margin: 0 0 28px;
  color: var(--muted);
  line-height: 1.7;
}

.login-panel label {
  display: block;
  margin-top: 18px;
}

.login-panel label > span {
  display: block;
  margin-bottom: 8px;
  font-weight: 650;
}

.login-panel input,
.field-control,
.field-select {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  border: 1px solid #dce3ed;
  border-radius: 6px;
  outline: none;
  background: #fbfcfe;
  color: var(--ink);
}

.login-panel input:focus,
.field-control:focus,
.field-select:focus {
  border-color: #77aaf0;
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.1);
}

textarea.field-control {
  min-height: 104px;
  height: auto;
  padding-top: 11px;
  padding-bottom: 11px;
  line-height: 1.55;
  resize: vertical;
}

.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  min-height: 40px;
  padding: 0 17px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 6px;
  font-weight: 650;
  white-space: nowrap;
}

.primary-button {
  color: #ffffff;
  background: var(--blue);
}

.primary-button:hover {
  background: var(--blue-dark);
}

.secondary-button {
  color: #344158;
  border: 1px solid #d9e0ea;
  background: #ffffff;
}

.secondary-button:hover {
  border-color: #a9bdd9;
  background: #f8fbff;
}

.danger-button {
  color: #ffffff;
  background: var(--red);
}

.login-button {
  width: 100%;
  margin-top: 26px;
}

.login-error {
  min-height: 20px;
  margin-top: 12px;
  color: var(--red);
  text-align: center;
  font-size: 13px;
}

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

.sidebar {
  position: fixed;
  z-index: 20;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  width: 88px;
  flex-direction: column;
  align-items: center;
  background: var(--navy);
  box-shadow: 8px 0 28px rgba(12, 39, 77, 0.12);
}

.sidebar-brand {
  display: grid;
  width: 100%;
  height: 78px;
  place-items: center;
}

.sidebar-brand .brand-mark {
  background: rgba(255, 255, 255, 0.14);
}

.sidebar-nav {
  display: flex;
  width: 100%;
  margin-top: 18px;
  flex-direction: column;
  gap: 8px;
}

.nav-button {
  position: relative;
  display: flex;
  width: 100%;
  height: 62px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: rgba(255, 255, 255, 0.68);
  border: 0;
  background: transparent;
  font-size: 11px;
}

.nav-button svg {
  width: 22px;
  height: 22px;
}

.nav-button:hover,
.nav-button.is-active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-button.is-active::before {
  content: "";
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #4e9bff;
}

.workspace {
  width: calc(100% - 88px);
  margin-left: 88px;
}

.topbar {
  position: sticky;
  z-index: 15;
  top: 0;
  display: flex;
  height: 74px;
  padding: 0 32px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.topbar-search {
  display: flex;
  width: min(520px, 48vw);
  height: 42px;
  padding: 0 13px;
  align-items: center;
  gap: 10px;
  border: 1px solid #dfe5ee;
  border-radius: 6px;
  background: #fafbfd;
}

.topbar-search svg {
  width: 18px;
  height: 18px;
  color: #8a95a8;
}

.topbar-search input {
  height: 100%;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 11px;
}

.admin-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #ffffff;
  border-radius: 50%;
  background: var(--blue);
  font-weight: 700;
}

.topbar-user strong,
.topbar-user button {
  display: block;
}

.topbar-user button {
  margin-top: 2px;
  padding: 0;
  color: var(--muted);
  border: 0;
  background: transparent;
  font-size: 12px;
}

.main-content {
  padding: 26px 30px 48px;
}

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

.page-heading h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.25;
}

.page-heading p {
  margin: 7px 0 0;
  color: var(--muted);
}

.panel {
  border: 1px solid rgba(23, 32, 51, 0.05);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 26px rgba(24, 48, 83, 0.055);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.stat-card {
  padding: 24px;
}

.stat-card span {
  color: var(--muted);
}

.stat-card strong {
  display: block;
  margin-top: 14px;
  font-size: 32px;
}

.stat-card small {
  display: block;
  margin-top: 9px;
  color: #8c98ab;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.45fr 0.8fr;
  gap: 20px;
  margin-top: 20px;
}

.panel-head {
  display: flex;
  min-height: 62px;
  padding: 0 22px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0;
  font-size: 17px;
}

.panel-body {
  padding: 20px 22px;
}

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

.activity-item {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #edf0f5;
}

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

.activity-main strong,
.activity-main span {
  display: block;
}

.activity-main span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.filter-panel {
  margin-bottom: 20px;
  padding: 20px;
}

.filter-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) repeat(3, minmax(150px, 0.75fr)) auto;
  gap: 14px;
  align-items: end;
}

.filter-actions {
  display: flex;
  gap: 10px;
}

.field-group > span {
  display: block;
  margin-bottom: 8px;
  color: #4a566c;
  font-weight: 650;
}

.generator-panel {
  margin-bottom: 20px;
  padding: 22px;
}

.generator-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr auto;
  gap: 16px;
  align-items: end;
}

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

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

.toolbar-actions {
  display: flex;
  gap: 10px;
}

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

.barcode-card {
  position: relative;
  padding: 20px;
}

.barcode-card.is-selected {
  border-color: #8db8f7;
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.08);
}

.barcode-check {
  position: absolute;
  top: 13px;
  left: 13px;
  width: 17px;
  height: 17px;
}

.barcode-svg {
  display: block;
  width: 100%;
  height: 104px;
  margin-top: 4px;
  background: #ffffff;
}

.barcode-code {
  margin-top: 12px;
  text-align: center;
}

.barcode-code strong {
  display: block;
  font-size: 15px;
  letter-spacing: 0.4px;
}

.barcode-code span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.barcode-actions {
  display: flex;
  margin-top: 16px;
  align-items: center;
  justify-content: space-between;
}

.status-pill {
  display: inline-flex;
  min-height: 27px;
  padding: 0 10px;
  align-items: center;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 650;
}

.status-pill.available {
  color: #0f5fd7;
  background: #eaf4ff;
}

.status-pill.printed,
.status-pill.submitted {
  color: #0b8d57;
  background: #e7f9f0;
}

.status-pill.used,
.status-pill.completed {
  color: #42526b;
  background: #edf1f6;
}

.status-pill.pending {
  color: #b26a00;
  background: #fff3d8;
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #536077;
  border: 1px solid #dce3ed;
  border-radius: 6px;
  background: #ffffff;
}

.icon-button:hover {
  color: var(--blue);
  border-color: #9dc1f7;
  background: #f8fbff;
}

.icon-button svg {
  width: 17px;
  height: 17px;
}

.table-wrap {
  overflow: hidden;
}

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

.data-table th,
.data-table td {
  padding: 16px 18px;
  border-bottom: 1px solid #edf0f5;
  text-align: left;
}

.data-table th {
  color: #657187;
  background: #fafbfd;
  font-size: 12px;
  font-weight: 650;
}

.data-table tbody tr:hover {
  background: #fbfdff;
}

.table-actions {
  display: flex;
  gap: 8px;
}

.text-action {
  padding: 0;
  color: var(--blue);
  border: 0;
  background: transparent;
}

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

.pagination {
  display: flex;
  padding: 18px 20px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
}

.page-buttons {
  display: flex;
  gap: 6px;
}

.page-button {
  display: grid;
  min-width: 34px;
  height: 34px;
  padding: 0 9px;
  place-items: center;
  color: #48556a;
  border: 1px solid #dce3ed;
  border-radius: 5px;
  background: #ffffff;
}

.page-button.is-active {
  color: #ffffff;
  border-color: var(--blue);
  background: var(--blue);
}

.empty-block {
  display: grid;
  min-height: 260px;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.empty-block svg {
  width: 54px;
  height: 54px;
  margin-bottom: 12px;
  color: #aeb9ca;
}

.modal-mask {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  padding: 24px;
  place-items: center;
  background: rgba(10, 20, 35, 0.58);
}

.modal-panel {
  width: min(620px, 92vw);
  max-height: 88vh;
  overflow: auto;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(8, 23, 45, 0.26);
}

.modal-head {
  display: flex;
  padding: 20px 22px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-size: 18px;
}

.modal-body {
  padding: 22px;
}

.modal-actions {
  display: flex;
  padding: 0 22px 22px;
  justify-content: flex-end;
  gap: 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.toast-root {
  position: fixed;
  z-index: 200;
  top: 22px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  min-width: 230px;
  padding: 13px 16px;
  color: #ffffff;
  border-radius: 6px;
  background: #172033;
  box-shadow: 0 12px 30px rgba(15, 28, 48, 0.2);
}

.toast.success {
  background: #0f9f68;
}

.toast.error {
  background: #d83a3a;
}

@media (max-width: 1380px) {
  .barcode-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .filter-actions {
    grid-column: 1 / -1;
  }

  .generator-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media print {
  body {
    min-width: auto;
    background: #ffffff;
  }

  .sidebar,
  .topbar,
  .page-heading,
  .filter-panel,
  .generator-panel,
  .barcode-toolbar,
  .barcode-actions {
    display: none !important;
  }

  .workspace {
    width: 100%;
    margin: 0;
  }

  .main-content {
    padding: 0;
  }

  .barcode-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }

  .barcode-card {
    break-inside: avoid;
    border: 1px solid #ccd4df;
    box-shadow: none;
  }
}
