:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #667085;
  --border: #d9e0e8;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(16, 24, 40, 0.08);
}

* { box-sizing: border-box; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  min-height: 72px;
  padding: 16px 28px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand-area { display: flex; align-items: center; gap: 12px; }
.brand-logo { display: block; width: auto; height: 42px; object-fit: contain; }
.brand-text { display: grid; gap: 2px; }
.brand { font-size: 20px; font-weight: 700; letter-spacing: 0; line-height: 24px; }
.sub { color: var(--muted); font-size: 13px; line-height: 16px; }
.nav { display: flex; align-items: center; gap: 16px; font-size: 14px; color: var(--muted); }
.nav a { color: var(--accent-dark); text-decoration: none; font-weight: 600; }
.nav-menu { position: relative; }
.nav-menu-trigger {
  border: 1px solid #b8c7d6;
  border-radius: 6px;
  padding: 8px 12px;
  background: #f7fafc;
  color: var(--accent-dark);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}
.nav-menu-trigger:hover,
.nav-menu-trigger:focus-visible {
  background: #eaf3f2;
  border-color: var(--accent);
  outline: none;
}
.nav-menu-trigger::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 6px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}
.nav-submenu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 20;
  display: none;
  min-width: 190px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.nav-menu:hover .nav-submenu,
.nav-menu:focus-within .nav-submenu,
.nav-menu.is-open .nav-submenu {
  display: block;
}
.nav-submenu a {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  white-space: nowrap;
}
.nav-submenu a:hover,
.nav-submenu a:focus-visible {
  background: #eef3f7;
  outline: none;
}
.nav-menu-empty .nav-menu-trigger::after,
.nav-submenu[hidden] {
  display: none !important;
}

.page { max-width: 1440px; margin: 0 auto; padding: 32px 24px; }
.panel, .login-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 8px;
  padding: 28px;
}
.login-panel { max-width: 440px; margin: 72px auto; }
.login-brand { display: grid; justify-items: center; gap: 18px; margin-bottom: 26px; text-align: center; }
.login-brand img { display: block; width: min(260px, 100%); height: auto; object-fit: contain; }
.login-brand h1 { margin: 0; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
h1 { margin: 0 0 6px; font-size: 28px; line-height: 1.2; }
h2 { margin: 0 0 16px; font-size: 18px; }
p { color: var(--muted); margin: 0 0 16px; line-height: 1.5; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; font-size: 14px; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0; background: #fafbfc; }
.cell-warning {
  background: #fff7cc;
  color: #7a4d00;
  font-weight: 700;
}
.cell-danger {
  background: #fee4e2;
  color: #912018;
  font-weight: 700;
}

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 24px; }
.box { border: 1px solid var(--border); border-radius: 8px; padding: 18px; background: #fbfcfd; }
.wide-box { grid-column: 1 / -1; }
.admin-section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 4px 0 14px; }
.admin-section-head h2, .admin-section-head p { margin-bottom: 4px; }
.roles-heading { margin-top: 34px; }
.user-create-form { grid-template-columns: repeat(3, minmax(160px, 1fr)); margin-bottom: 18px; }
.user-create-form .actions { align-self: end; }
.check-label { display: flex !important; flex-direction: row !important; align-items: center; justify-content: flex-start; gap: 8px !important; min-height: 42px; font-size: 14px !important; font-weight: 600; }
.check-label input { width: auto; min-width: 0; margin: 0; }
.user-cards { display: grid; grid-template-columns: repeat(3, minmax(260px, 1fr)); gap: 16px; }
.user-card { display: grid; gap: 14px; }
.user-card-head { display: flex; align-items: center; gap: 12px; }
.user-card-head h3 { margin: 0 0 5px; font-size: 17px; }
.user-avatar { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: #d9eeeb; color: var(--accent-dark); font-weight: 800; }
.status-badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.status-badge.is-active { background: #dcfae6; color: #067647; }
.status-badge.is-inactive { background: #f2f4f7; color: #667085; }
.user-edit-form { grid-template-columns: 1fr 1fr; gap: 10px; }
.user-edit-form label:first-child, .user-edit-form label:nth-child(3), .user-edit-form label:nth-child(5) { grid-column: 1 / -1; }
.user-meta { color: var(--muted); font-size: 12px; }
.user-card-actions { justify-content: space-between; align-items: center; }
.role-card { margin-bottom: 14px; padding: 0; overflow: hidden; }
.role-card summary { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 18px; cursor: pointer; list-style: none; background: #fbfcfd; }
.role-card summary::-webkit-details-marker { display: none; }
.role-card summary span:first-child { display: grid; gap: 4px; }
.role-card summary small { display: block; color: var(--muted); font-weight: 400; }
.role-card[open] summary { border-bottom: 1px solid var(--border); }
.role-form { padding: 18px; }
.role-meta-form { grid-template-columns: 180px 1fr 2fr 120px; margin-bottom: 18px; }
.permission-groups { display: grid; grid-template-columns: repeat(3, minmax(240px, 1fr)); gap: 14px; margin-bottom: 18px; }
.permission-groups fieldset { min-width: 0; margin: 0; padding: 14px; border: 1px solid var(--border); border-radius: 8px; }
.permission-groups legend { padding: 0 6px; font-size: 13px; font-weight: 800; color: var(--accent-dark); }
.permission-item { display: flex; flex-direction: row; align-items: flex-start; gap: 9px; padding: 8px 4px; font-size: 13px; font-weight: 600; }
.permission-item + .permission-item { border-top: 1px solid #edf0f3; }
.permission-item input { width: auto; min-width: 0; margin: 2px 0 0; }
.permission-item span { min-width: 0; }
.permission-item small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 400; overflow-wrap: anywhere; }
.new-role-card summary { color: var(--accent-dark); }
.button-link { display: inline-flex; align-items: center; text-decoration: none; }
.inquiry-capture { max-width: 1180px; margin: 0 auto; }
.inquiry-form { gap: 18px; }
.inquiry-form-section {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 16px;
  margin: 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfcfd;
}
.inquiry-form-section legend { padding: 0 8px; font-size: 15px; font-weight: 800; color: var(--accent-dark); }
.inquiry-form-main label:first-of-type,
.inquiry-form-main label:nth-of-type(2) { grid-column: 1 / -1; }
.inquiry-form-main label:last-of-type { grid-column: span 2; }
.inquiry-datetime-fields { display: grid; grid-template-columns: max-content; gap: 12px; min-width: 0; justify-self: start; }
.inquiry-datetime-fields label { min-width: 0; }
.inquiry-datetime-fields input[type="date"] { display: block; width: 175px; min-width: 0; max-width: 175px; }
.inquiry-datetime-fields input[type="time"] { display: block; width: 135px; min-width: 0; max-width: 135px; }
.inquiry-form textarea { resize: vertical; min-height: 130px; }
.inquiry-submit-bar {
  position: sticky;
  bottom: 12px;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 14px 16px;
  border: 1px solid #a7cfca;
  border-radius: 8px;
  background: #eef8f6;
  box-shadow: 0 10px 30px rgba(16, 24, 40, .12);
}
.inquiry-submit-bar span { color: var(--muted); font-size: 13px; }
.inquiry-filter { grid-template-columns: 2fr 1fr 1fr auto; margin-bottom: 20px; }
.inquiry-filter .actions { align-self: end; }
.inquiry-table { min-width: 1100px; table-layout: fixed; }
.inquiry-table th, .inquiry-table td { padding: 9px 8px; font-size: 12px; line-height: 1.35; }
.inquiry-table th:nth-child(1) { width: 112px; }
.inquiry-table th:nth-child(2) { width: 125px; }
.inquiry-table th:nth-child(3) { width: 80px; }
.inquiry-table th:nth-child(4) { width: 190px; }
.inquiry-table th:nth-child(5) { width: 30%; }
.inquiry-table th:nth-child(6) { width: 90px; }
.inquiry-table th:nth-child(7) { width: 130px; }
.inquiry-table th:nth-child(8) { width: 130px; }
.inquiry-status { display: inline-flex; padding: 4px 8px; border-radius: 999px; background: #eef2f6; color: #344054; font-weight: 700; }
.inquiry-status.status-new { background: #e0f2fe; color: #075985; }
.inquiry-status.status-incomplete { background: #fff7cc; color: #7a4d00; }
.inquiry-status.status-ordered { background: #dcfae6; color: #067647; }
.inquiry-status.status-declined { background: #f2f4f7; color: #667085; }
.inquiry-detail-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, .8fr); gap: 20px; align-items: start; }
.inquiry-edit-form { grid-template-columns: repeat(2, minmax(180px, 1fr)); padding: 20px; border: 1px solid var(--border); border-radius: 8px; background: #fbfcfd; }
.inquiry-edit-form .span-2 { grid-column: 1 / -1; }
.inquiry-sidebar { display: grid; gap: 16px; }
.inquiry-sidebar .box { background: #fff; }
.inquiry-timeline { display: grid; gap: 0; }
.inquiry-timeline > div { position: relative; display: grid; gap: 4px; padding: 0 0 16px 18px; border-left: 2px solid #d9e0e8; font-size: 12px; }
.inquiry-timeline > div::before { content: ""; position: absolute; left: -5px; top: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.inquiry-timeline span { color: var(--muted); }
.task-section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 18px 0 10px; }
.task-section-head h2 { margin: 0; }
.task-section-head > span, .task-section-head .actions > span { color: var(--muted); font-size: 13px; }
.task-section-spacing { margin-top: 30px; }
.inquiry-task-table { min-width: 980px; }
.priority-badge { display: inline-flex; padding: 4px 8px; border-radius: 999px; background: #f2f4f7; color: #475467; font-size: 11px; font-weight: 700; }
.priority-badge.priority-high { background: #fff7cc; color: #7a4d00; }
.priority-badge.priority-urgent { background: #fee4e2; color: #912018; }
.inventory-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.inventory-summary .box h2 {
  margin-bottom: 8px;
  font-size: 15px;
}
.inventory-summary .box p {
  margin: 0;
  font-weight: 700;
  color: var(--text);
}
.facts { display: grid; grid-template-columns: 150px 1fr; gap: 10px 14px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; word-break: break-word; }
.facts dd .inline-action { margin-top: 8px; }
.compact-facts {
  grid-template-columns: 115px 1fr;
  margin-top: 14px;
  margin-bottom: 14px;
}
.status-note {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 14px;
  line-height: 1.4;
}
.status-note.success {
  background: #ecfdf3;
  border-color: #abefc6;
  color: #067647;
}
.status-note.warning {
  background: #fffaeb;
  border-color: #fedf89;
  color: #93370d;
}
.field-warning {
  display: block;
  margin-top: 6px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.form { display: grid; gap: 16px; }
.review-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.inventory-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 28px;
}
.inventory-form label:nth-of-type(1),
.inventory-form label:nth-of-type(2),
.inventory-form label:nth-of-type(9) {
  grid-column: span 2;
}
.inventory-select-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  margin-bottom: 22px;
}
.inventory-item-panel {
  margin-bottom: 28px;
}
.inventory-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.inventory-item-head h2 {
  margin: 0;
}
.inventory-items-form {
  display: grid;
  gap: 16px;
}
.inventory-items-form input,
.inventory-items-form select {
  min-width: 120px;
  padding: 8px;
}
.inventory-items-form td:first-child input {
  min-width: 220px;
}
.inventory-items-form tr.is-assigned {
  background: #f3f6f8;
}
.inventory-stock-filter {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  margin-bottom: 22px;
}
.invoice-filter {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  margin-bottom: 22px;
}
.supplier-filter {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  margin-bottom: 22px;
}
.login-history-filter {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  margin-bottom: 22px;
}
.inventory-stock-filter label:first-of-type {
  grid-column: span 2;
}
.invoice-filter label:first-of-type {
  grid-column: span 2;
}
.supplier-filter label:first-of-type {
  grid-column: span 2;
}
.login-history-filter label:first-of-type {
  grid-column: span 2;
}
.inventory-stock-actions {
  justify-content: flex-end;
  margin-bottom: 14px;
}
.invoice-actions {
  justify-content: flex-end;
  margin-bottom: 14px;
}
.supplier-actions {
  justify-content: flex-end;
  margin-bottom: 14px;
}
.inventory-stock-editor {
  margin-bottom: 16px;
}
.invoice-editor {
  margin-bottom: 16px;
}
.supplier-editor {
  margin-bottom: 16px;
}
.inventory-stock-editor h2 {
  margin-bottom: 12px;
}
.invoice-editor h2 {
  margin-bottom: 12px;
}
.supplier-editor h2 {
  margin-bottom: 12px;
}
.inventory-stock-edit-form {
  grid-template-columns: repeat(4, minmax(140px, 1fr));
}
.invoice-edit-form {
  grid-template-columns: repeat(4, minmax(140px, 1fr));
}
.supplier-edit-form {
  grid-template-columns: repeat(4, minmax(140px, 1fr));
}
.inventory-stock-edit-form label:first-of-type,
.inventory-stock-edit-form label:last-of-type {
  grid-column: span 2;
}
.invoice-edit-form label:first-of-type,
.invoice-edit-form label:nth-of-type(10) {
  grid-column: span 2;
}
.supplier-edit-form label:first-of-type,
.supplier-edit-form label:nth-of-type(18) {
  grid-column: span 2;
}
.inventory-stock-filter label,
.inventory-stock-edit-form label,
.invoice-filter label,
.invoice-edit-form label,
.supplier-filter label,
.supplier-edit-form label,
.login-history-filter label {
  font-size: 0;
  gap: 0;
}
.inventory-stock-filter input,
.inventory-stock-filter select,
.inventory-stock-edit-form input,
.inventory-stock-edit-form select,
.invoice-filter input,
.invoice-filter select,
.invoice-edit-form input,
.invoice-edit-form select,
.supplier-filter input,
.supplier-filter select,
.supplier-edit-form input,
.supplier-edit-form select,
.login-history-filter input {
  font-size: 14px;
}
.table-scroll {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.inventory-stock-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}
.invoice-grid-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}
.supplier-grid-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}
.login-history-table {
  width: 100%;
  min-width: 780px;
  table-layout: fixed;
}
.inventory-stock-table th,
.inventory-stock-table td,
.invoice-grid-table th,
.invoice-grid-table td,
.supplier-grid-table th,
.supplier-grid-table td,
.login-history-table th,
.login-history-table td {
  padding: 8px 7px;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: normal;
}
.inventory-stock-table th,
.invoice-grid-table th,
.supplier-grid-table th,
.login-history-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.inventory-stock-table td,
.invoice-grid-table td,
.supplier-grid-table td,
.login-history-table td {
  vertical-align: middle;
}
.login-history-table th:nth-child(1), .login-history-table td:nth-child(1) { width: 54px; }
.login-history-table th:nth-child(2), .login-history-table td:nth-child(2) { width: 132px; }
.login-history-table th:nth-child(3), .login-history-table td:nth-child(3) { width: 24%; }
.login-history-table th:nth-child(4), .login-history-table td:nth-child(4) { width: 78px; }
.login-history-table th:nth-child(5), .login-history-table td:nth-child(5) { width: 20%; }
.login-history-table th:nth-child(6), .login-history-table td:nth-child(6) { width: 16%; }
.login-history-table th:nth-child(7), .login-history-table td:nth-child(7) { width: 18%; }
.inventory-stock-table th:nth-child(1), .inventory-stock-table td:nth-child(1) { width: 54px; text-align: center; }
.inventory-stock-table th:nth-child(2), .inventory-stock-table td:nth-child(2) { width: 44px; }
.inventory-stock-table th:nth-child(3), .inventory-stock-table td:nth-child(3) { width: 118px; }
.inventory-stock-table th:nth-child(4), .inventory-stock-table td:nth-child(4) { width: 98px; }
.inventory-stock-table th:nth-child(5), .inventory-stock-table td:nth-child(5) { width: 24%; }
.inventory-stock-table th:nth-child(6), .inventory-stock-table td:nth-child(6) { width: 76px; }
.inventory-stock-table th:nth-child(7), .inventory-stock-table td:nth-child(7) { width: 76px; }
.inventory-stock-table th:nth-child(8), .inventory-stock-table td:nth-child(8) { width: 132px; }
.inventory-stock-table th:nth-child(9), .inventory-stock-table td:nth-child(9) { width: 92px; }
.inventory-stock-table th:nth-child(10), .inventory-stock-table td:nth-child(10) { width: 150px; }
.inventory-stock-table th:nth-child(12), .inventory-stock-table td:nth-child(12) { width: 82px; }
.invoice-grid-table th:nth-child(1), .invoice-grid-table td:nth-child(1) { width: 54px; text-align: center; }
.invoice-grid-table th:nth-child(2), .invoice-grid-table td:nth-child(2) { width: 44px; }
.invoice-grid-table th:nth-child(3), .invoice-grid-table td:nth-child(3) { width: 122px; }
.invoice-grid-table th:nth-child(4), .invoice-grid-table td:nth-child(4) { width: 18%; }
.invoice-grid-table th:nth-child(5), .invoice-grid-table td:nth-child(5) { width: 92px; }
.invoice-grid-table th:nth-child(6), .invoice-grid-table td:nth-child(6) { width: 92px; }
.invoice-grid-table th:nth-child(7), .invoice-grid-table td:nth-child(7) { width: 78px; }
.invoice-grid-table th:nth-child(8), .invoice-grid-table td:nth-child(8) { width: 82px; }
.invoice-grid-table th:nth-child(9), .invoice-grid-table td:nth-child(9) { width: 60px; }
.invoice-grid-table th:nth-child(10), .invoice-grid-table td:nth-child(10) { width: 94px; }
.invoice-grid-table th:nth-child(11), .invoice-grid-table td:nth-child(11) { width: 86px; }
.invoice-grid-table th:nth-child(12), .invoice-grid-table td:nth-child(12) { width: 82px; }
.supplier-grid-table th:nth-child(1), .supplier-grid-table td:nth-child(1) { width: 54px; text-align: center; }
.supplier-grid-table th:nth-child(2), .supplier-grid-table td:nth-child(2) { width: 44px; }
.supplier-grid-table th:nth-child(3), .supplier-grid-table td:nth-child(3) { width: 90px; }
.supplier-grid-table th:nth-child(4), .supplier-grid-table td:nth-child(4) { width: 68px; }
.supplier-grid-table th:nth-child(5), .supplier-grid-table td:nth-child(5) { width: 22%; }
.supplier-grid-table th:nth-child(6), .supplier-grid-table td:nth-child(6) { width: 116px; }
.supplier-grid-table th:nth-child(7), .supplier-grid-table td:nth-child(7) { width: 19%; }
.supplier-grid-table th:nth-child(8), .supplier-grid-table td:nth-child(8) { width: 21%; }
.supplier-grid-table th:nth-child(9), .supplier-grid-table td:nth-child(9) { width: 20%; }
.inventory-stock-table tr.is-selected {
  background: #eaf3f2;
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.invoice-grid-table tr.is-selected {
  background: #eaf3f2;
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.supplier-grid-table tr.is-selected {
  background: #eaf3f2;
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.inventory-stock-table tbody tr {
  cursor: pointer;
}
.invoice-grid-table tbody tr {
  cursor: pointer;
}
.supplier-grid-table tbody tr {
  cursor: pointer;
}
.inventory-stock-table tbody tr:hover,
.invoice-grid-table tbody tr:hover,
.supplier-grid-table tbody tr:hover {
  background: #f6fbfa;
}
.stock-quantity-cell {
  display: grid;
  grid-template-columns: 90px 70px 90px;
  gap: 6px;
}
.checkbox-label {
  grid-template-columns: auto 1fr;
  align-items: start;
  color: var(--text);
}
.checkbox-label input {
  width: auto;
  margin-top: 3px;
}
.compact-checkbox {
  font-size: 12px;
  gap: 6px;
}
.inline-form {
  display: inline;
}
.table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 600; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 11px 12px;
  font: inherit;
  color: var(--text);
  background: #fff;
}
.parameter-table input { min-width: 90px; padding: 8px; }
.parameter-table input[type="checkbox"] { min-width: 0; width: auto; }
.parameter-section {
  display: grid;
  gap: 12px;
}
.parameter-section + .parameter-section {
  margin-top: 26px;
}
.parameter-new-row td {
  background: #f6fbfa;
  border-top: 2px solid var(--accent);
}
.table-date-input { min-width: 140px; padding: 8px; }
.candidate-table th:last-child,
.candidate-table td:last-child {
  text-align: right;
  white-space: nowrap;
}
.candidate-table td {
  word-break: break-word;
}
textarea, .actions { grid-column: 1 / -1; }
pre {
  min-height: 54px;
  white-space: pre-wrap;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}
.label { font-size: 13px; font-weight: 700; margin-bottom: 8px; }

.primary, .secondary, .danger {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 11px 16px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
  min-height: 40px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.10), inset 0 -1px 0 rgba(16, 24, 40, 0.12);
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease;
  white-space: normal;
  text-align: center;
}
.primary:hover,
.secondary:hover,
.danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(16, 24, 40, 0.14), inset 0 -1px 0 rgba(16, 24, 40, 0.12);
}
.primary:active,
.secondary:active,
.danger:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.10), inset 0 1px 2px rgba(16, 24, 40, 0.16);
}
.primary:focus-visible,
.secondary:focus-visible,
.danger:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.28);
  outline-offset: 2px;
}
.primary:disabled,
.secondary:disabled,
.danger:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
  box-shadow: none;
}
.primary {
  background: var(--accent);
  border-color: var(--accent-dark);
  color: #fff;
}
.primary:hover { background: var(--accent-dark); }
.secondary {
  background: #ffffff;
  border-color: #9aaabd;
  color: #213547;
}
.secondary:hover {
  background: #eef4f8;
  border-color: #697b8f;
}
.danger {
  background: var(--danger);
  border-color: #7a271a;
  color: #fff;
}
.danger:hover { background: #912018; }
.small {
  min-height: 34px;
  padding: 8px 12px;
  font-size: 13px;
}
.actions { display: flex; gap: 12px; justify-content: flex-end; }
.op-actions { margin-top: 18px; }
.alert, .success {
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 18px;
}
.alert { background: #fef3f2; color: #912018; border: 1px solid #fecdca; }
.success { background: #ecfdf3; color: #05603a; border: 1px solid #abefc6; }
.intake-status {
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 18px;
  background: #ecfdf3;
  color: #05603a;
  border: 1px solid #abefc6;
  font-weight: 700;
}
.intake-status.is-error {
  background: #fef3f2;
  color: #912018;
  border-color: #fecdca;
}
.intake-popup {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(23, 32, 42, 0.28);
}
.intake-popup.is-visible { display: grid; }
.intake-popup__panel {
  width: min(420px, 100%);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 22px;
  display: grid;
  gap: 18px;
}
.intake-popup__panel p {
  color: var(--text);
  font-weight: 700;
  margin: 0;
}
.intake-popup.is-error .intake-popup__panel {
  border-color: #fecdca;
}

.explorer {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.explorer-head,
.explorer-row {
  display: grid;
  grid-template-columns: minmax(340px, 1.7fr) minmax(210px, 1fr) 110px 150px 96px;
  gap: 12px;
  align-items: center;
}
.explorer-head {
  padding: 11px 14px;
  background: #fafbfc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.explorer-row {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  font-size: 14px;
}
.explorer-row.is-hidden {
  display: none;
}
.explorer-row.is-folder {
  background: #fbfcfd;
}
.explorer-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding-left: calc(var(--level) * 22px);
}
.explorer-icon {
  width: 24px;
  text-align: center;
  flex: 0 0 24px;
}
.tree-toggle,
.tree-spacer {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
}
.tree-toggle {
  border: 1px solid #b8c7d6;
  border-radius: 4px;
  background: #ffffff;
  cursor: pointer;
  position: relative;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.10);
}
.tree-toggle::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 8px;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid var(--muted);
}
.explorer-row.is-expanded > .explorer-name .tree-toggle::before {
  top: 8px;
  left: 6px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid var(--muted);
  border-bottom: 0;
}
.tree-toggle:hover,
.tree-toggle:focus-visible {
  border-color: var(--accent);
  background: #eef3f7;
  outline: none;
}
.explorer-name strong,
.explorer-name small {
  display: block;
  overflow-wrap: anywhere;
}
.explorer-name small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}
.explorer-empty {
  padding: 18px;
  color: var(--muted);
}

.task-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) 12px minmax(520px, 1.15fr);
  gap: 12px;
  align-items: start;
}
.task-results { min-width: 0; }
.document-pane {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 14px;
  min-height: 760px;
}
.layout-resizer {
  align-self: stretch;
  min-height: 760px;
  cursor: col-resize;
  border-radius: 6px;
  position: relative;
}
.layout-resizer::before {
  content: "";
  position: absolute;
  inset: 0 4px;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: #eef3f7;
  border-radius: 6px;
}
.layout-resizer:hover::before,
.layout-resizer:focus-visible::before {
  background: #d9e8e6;
  border-color: var(--accent);
}
.is-resizing,
.is-resizing * {
  cursor: col-resize !important;
  user-select: none;
}
.document-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.document-head h2 { margin: 0; }
.document-frame {
  width: 100%;
  height: 700px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}
.document-empty {
  min-height: 700px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: #fff;
}

@media (max-width: 780px) {
  .topbar, .panel-head { flex-direction: column; align-items: flex-start; }
  .nav { flex-wrap: wrap; }
  .grid, .review-form, .inventory-form, .inventory-select-form, .inventory-summary, .inventory-stock-filter, .inventory-stock-edit-form, .invoice-filter, .invoice-edit-form, .supplier-filter, .supplier-edit-form, .login-history-filter, .task-layout { grid-template-columns: 1fr !important; }
  .inventory-stock-filter label:first-of-type { grid-column: auto; }
  .invoice-filter label:first-of-type { grid-column: auto; }
  .supplier-filter label:first-of-type { grid-column: auto; }
  .login-history-filter label:first-of-type { grid-column: auto; }
  .inventory-stock-edit-form label:first-of-type,
  .inventory-stock-edit-form label:last-of-type { grid-column: auto; }
  .invoice-edit-form label:first-of-type,
  .invoice-edit-form label:nth-of-type(10) { grid-column: auto; }
  .supplier-edit-form label:first-of-type,
  .supplier-edit-form label:nth-of-type(18) { grid-column: auto; }
  .explorer-head { display: none; }
  .explorer-row {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .facts { grid-template-columns: 1fr; }
  .document-pane { min-height: 520px; }
  .layout-resizer { display: none; }
  .document-frame, .document-empty { height: 460px; min-height: 460px; }
  .user-create-form, .user-cards, .user-edit-form, .role-meta-form, .permission-groups { grid-template-columns: 1fr !important; }
  .user-edit-form label { grid-column: auto !important; }
  .inquiry-form-section, .inquiry-filter, .inquiry-edit-form, .inquiry-detail-layout { grid-template-columns: 1fr !important; }
  .inquiry-form-section label, .inquiry-edit-form .span-2 { grid-column: auto !important; }
  .inquiry-submit-bar { position: static; flex-direction: column; align-items: stretch; }
  .inquiry-datetime-fields { width: auto; max-width: 100%; }
  .inquiry-datetime-fields input[type="date"] { width: 165px; max-width: 165px; }
  .inquiry-datetime-fields input[type="time"] { width: 125px; max-width: 125px; }
  th:nth-child(4), td:nth-child(4), th:nth-child(5), td:nth-child(5) { display: none; }
  .inventory-stock-table th:nth-child(4),
  .inventory-stock-table td:nth-child(4),
  .inventory-stock-table th:nth-child(5),
  .inventory-stock-table td:nth-child(5) { display: table-cell; }
  .invoice-grid-table th:nth-child(4),
  .invoice-grid-table td:nth-child(4),
  .invoice-grid-table th:nth-child(5),
  .invoice-grid-table td:nth-child(5) { display: table-cell; }
  .supplier-grid-table th:nth-child(4),
  .supplier-grid-table td:nth-child(4),
  .supplier-grid-table th:nth-child(5),
  .supplier-grid-table td:nth-child(5) { display: table-cell; }
}
