:root {
  --primary: #174ea6;
  --primary-dark: #123b7d;
  --primary-soft: #e8f0fe;
  --surface: #ffffff;
  --background: #f5f7fb;
  --text: #182230;
  --muted: #667085;
  --border: #d9e0ea;
  --border-strong: #c5ceda;
  --success: #16794b;
  --success-soft: #e7f6ee;
  --warning: #9a6700;
  --warning-soft: #fff4d6;
  --danger: #b42318;
  --danger-soft: #feeceb;
  --shadow: 0 8px 28px rgba(35, 55, 80, .08);
  --radius: 14px;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--background);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--background); color: var(--text); }
body { font-size: 14px; line-height: 1.45; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
.hidden { display: none !important; }
.modal-open { overflow: hidden; }

h1, h2, h3, h4, p { margin-top: 0; }
h1 { letter-spacing: -.025em; }
a { color: inherit; }
code { font-family: Consolas, monospace; font-size: 12px; }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 10px 11px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 78, 166, .12);
}
textarea { resize: vertical; }
label { display: grid; gap: 6px; color: #344054; font-size: 12px; font-weight: 650; }

.primary, .secondary, .danger, .danger-outline, .table-button, .text-button, .icon-button {
  border: 0;
  border-radius: 9px;
  font-weight: 650;
  transition: transform .12s ease, background .18s ease, border-color .18s ease;
}
.primary { background: var(--primary); color: #fff; padding: 10px 16px; box-shadow: 0 2px 6px rgba(23, 78, 166, .2); }
.primary:hover { background: var(--primary-dark); }
.secondary { background: #fff; color: #344054; border: 1px solid var(--border-strong); padding: 9px 15px; }
.secondary:hover { background: #f8fafc; }
.danger { background: var(--danger); color: #fff; padding: 10px 16px; }
.danger-outline { color: var(--danger); background: #fff; border: 1px solid #efb4ae; padding: 9px 14px; }
.table-button { background: #fff; color: var(--primary); border: 1px solid #b7c9e9; padding: 7px 10px; white-space: nowrap; }
.table-button:hover { background: var(--primary-soft); }
.text-button { background: transparent; padding: 6px 2px; }
.danger-text { color: var(--danger); }
.icon-button { width: 38px; height: 38px; background: #fff; color: #475467; font-size: 25px; }
.full-button { width: 100%; min-height: 44px; }
.button-row, .document-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 20% 10%, rgba(23, 78, 166, .10), transparent 32%),
    linear-gradient(145deg, #f7f9fc, #eef3f9);
}
.login-panel {
  width: min(440px, 100%);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px;
  box-shadow: 0 24px 70px rgba(27, 54, 93, .14);
}
.company-symbol {
  width: 54px;
  height: 54px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.5px;
  margin-bottom: 22px;
}
.company-symbol.small { width: 38px; height: 38px; border-radius: 11px; margin: 0; font-size: 12px; }
.system-label, .eyebrow { color: var(--primary); font-size: 10px; font-weight: 800; letter-spacing: .13em; }
.login-panel h1 { font-size: 29px; margin-bottom: 8px; }
.login-intro { color: var(--muted); margin-bottom: 25px; }
.login-form { display: grid; gap: 15px; }
.company-contact { display: grid; gap: 3px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 11px; }

.application { min-height: 100vh; display: grid; grid-template-columns: 252px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  z-index: 20;
}
.sidebar-brand { display: flex; gap: 11px; align-items: center; padding: 3px 8px 19px; border-bottom: 1px solid var(--border); }
.sidebar-brand strong { display: block; font-size: 15px; }
.sidebar-brand small { display: block; color: var(--muted); font-size: 10px; }
.sidebar nav { display: grid; gap: 4px; padding: 16px 0; overflow-y: auto; }
.sidebar nav button, .sidebar-footer button {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 11px;
  border: 0;
  border-radius: 9px;
  color: #475467;
  background: transparent;
  text-align: left;
  font-size: 13px;
}
.sidebar nav button:hover, .sidebar-footer button:hover { background: #f3f6fb; color: var(--text); }
.sidebar nav button.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.nav-icon { width: 20px; text-align: center; font-size: 16px; }
.sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); display: grid; gap: 4px; }

.main-area { min-width: 0; }
.topbar {
  height: 76px;
  background: rgba(255, 255, 255, .95);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 15;
  backdrop-filter: blur(10px);
}
.topbar h2 { margin: 0; font-size: 20px; }
.topbar p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.profile-summary { display: flex; align-items: center; gap: 11px; text-align: right; }
.profile-summary strong, .profile-summary small { display: block; }
.profile-summary small { color: var(--muted); font-size: 11px; }
.avatar { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: #dbe7fa; color: var(--primary); font-weight: 800; }
.page-content { padding: 26px; max-width: 1560px; margin: 0 auto; }
.page { display: none; animation: pageIn .18s ease; }
.page.active { display: block; }
@keyframes pageIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.security-notice {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 14px 16px;
  background: var(--warning-soft);
  border: 1px solid #efd28b;
  border-radius: 11px;
  margin-bottom: 18px;
}
.security-notice p { margin: 2px 0 0; color: #6d4b00; font-size: 12px; }
.dashboard-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 28px;
  padding: 27px 29px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.dashboard-heading h1 { margin: 6px 0 9px; font-size: clamp(24px, 3vw, 34px); }
.dashboard-heading p:last-child { color: var(--muted); margin-bottom: 0; max-width: 760px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.metrics article { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 18px; box-shadow: 0 4px 16px rgba(35, 55, 80, .05); }
.metrics span { color: var(--muted); font-size: 12px; }
.metrics strong { display: block; margin-top: 6px; font-size: 28px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, .8fr); gap: 18px; }
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: 0 5px 20px rgba(35, 55, 80, .05); }
.section-heading { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 16px; }
.section-heading h3, .toolbar h3 { margin: 0 0 4px; font-size: 17px; }
.section-heading p, .toolbar p { margin: 0; color: var(--muted); font-size: 12px; }
.record-list { display: grid; }
.record-row { display: flex; justify-content: space-between; gap: 16px; align-items: center; border: 0; border-top: 1px solid var(--border); background: transparent; text-align: left; padding: 12px 2px; }
.record-row:first-child { border-top: 0; }
.record-row span { display: block; }
.record-row > span:last-child { text-align: right; }
.record-row small { color: var(--muted); display: block; margin-top: 3px; }
.server-details { display: grid; gap: 10px; }
.server-line { display: grid; gap: 4px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.server-line span { color: var(--muted); font-size: 11px; }
.server-line code { overflow-wrap: anywhere; color: var(--primary-dark); }
.help-text { color: var(--muted); font-size: 11px; margin: 4px 0 0; }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}
.sticky-toolbar { position: sticky; top: 90px; z-index: 10; background: rgba(245, 247, 251, .94); padding: 8px 0; backdrop-filter: blur(8px); }
.filter-group { display: flex; gap: 10px; flex: 1; }
.filter-group input { max-width: 360px; }
.filter-group select { width: auto; min-width: 180px; }
.count-badge { margin-left: 7px; background: rgba(255,255,255,.2); padding: 2px 7px; border-radius: 20px; }

.catalogue-category { margin-bottom: 28px; }
.catalogue-category-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 12px; }
.catalogue-category-heading h3 { margin: 0 0 3px; font-size: 20px; }
.catalogue-category-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.catalogue-category-heading > span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; align-items: stretch; }
.product-card {
  min-width: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 15px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 5px 18px rgba(35, 55, 80, .06);
  transition: transform .17s ease, box-shadow .17s ease, border-color .17s ease;
}
.product-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(35, 55, 80, .11); }
.product-card.selected { border-color: #8aadE2; box-shadow: 0 0 0 2px rgba(23, 78, 166, .10); }
.product-image-frame { width: 100%; aspect-ratio: 4 / 3; min-height: 190px; max-height: 260px; display: grid; place-items: center; overflow: hidden; background: #fff; border-bottom: 1px solid var(--border); }
.product-image-frame img { width: 100%; height: 100%; object-fit: contain; object-position: center; padding: 14px; display: block; }
.image-placeholder { color: #98a2b3; font-size: 12px; }
.product-card-content { padding: 15px; display: flex; flex-direction: column; flex: 1; min-height: 215px; }
.product-information { min-width: 0; flex: 1; }
.product-code { display: block; color: var(--primary); font-size: 10px; font-weight: 750; letter-spacing: .06em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-card h4 { margin: 7px 0; font-size: 16px; line-height: 1.32; min-height: 42px; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.product-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; min-height: 35px; max-height: 35px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.product-card-actions { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 9px; align-items: end; margin-top: 15px; }
.product-card-actions label { font-size: 10px; color: var(--muted); }
.product-card-actions input { height: 43px; text-align: center; padding: 8px; }
.product-card-actions button { min-height: 43px; padding: 8px 10px; line-height: 1.2; white-space: normal; }

.request-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.full-field { grid-column: 1 / -1; }
.checkbox-field { display: flex; align-items: center; gap: 9px; font-weight: 550; }
.checkbox-field input { width: auto; margin: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.table-card { padding: 0; overflow: hidden; }
.table-card > .section-heading { padding: 19px 20px 0; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { color: #475467; background: #f8fafc; font-size: 10px; text-transform: uppercase; letter-spacing: .045em; white-space: nowrap; }
td { font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfe; }
td strong, td small { display: block; }
td small { color: var(--muted); margin-top: 3px; }
.numeric { text-align: right; white-space: nowrap; }
.action-column { width: 1%; }
.empty-cell, .empty-state { color: var(--muted); text-align: center; padding: 25px; }
.product-cell { display: flex; gap: 10px; align-items: center; min-width: 180px; }
.product-cell img { width: 44px; height: 44px; object-fit: contain; background: #fff; border: 1px solid var(--border); border-radius: 6px; flex: 0 0 auto; }
.product-cell .signature-thumbnail, .signature-thumbnail { width: 70px; height: 38px; }
.quantity-table-input { width: 78px; }
.status-badge { display: inline-flex; align-items: center; width: fit-content; border-radius: 20px; padding: 4px 8px; background: #eef2f7; color: #475467; font-size: 10px; font-weight: 700; white-space: nowrap; }
.status-badge.success { background: var(--success-soft); color: var(--success); }
.status-badge.warning { background: var(--warning-soft); color: var(--warning); }
.inactive-row, .inactive-record { opacity: .63; }

.category-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 15px; }
.category-admin-card { background: #fff; border: 1px solid var(--border); border-radius: 13px; padding: 17px; box-shadow: 0 4px 16px rgba(35,55,80,.05); }
.category-card-heading { display: flex; justify-content: space-between; gap: 12px; }
.category-card-heading h4 { margin: 0; }
.category-card-heading span { color: var(--muted); font-size: 10px; }
.category-admin-card p { color: var(--muted); font-size: 12px; min-height: 34px; }
.category-card-meta { display: flex; justify-content: space-between; color: #475467; font-size: 11px; padding: 10px 0; border-top: 1px solid var(--border); }

.settings-form { max-width: 1000px; }
.backup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.warning-card { border-color: #edc6c2; }
.warning-card p { color: #7a271a; }
.warning-card input { margin: 9px 0 13px; }
.information-panel, .conditional-panel { background: #eef5ff; border-left: 4px solid var(--primary); padding: 13px; border-radius: 8px; }
.information-panel p, .conditional-panel p { margin: 3px 0 0; color: #475467; font-size: 12px; }
.confirmation-box { display: flex; align-items: flex-start; gap: 9px; background: var(--warning-soft); border: 1px solid #efd28b; padding: 12px; border-radius: 8px; }
.confirmation-box input { width: auto; margin-top: 2px; }
.image-preview { display: flex; gap: 12px; align-items: center; border: 1px solid var(--border); border-radius: 9px; padding: 10px; color: var(--muted); font-size: 11px; }
.image-preview img { width: 90px; height: 65px; object-fit: contain; }
.signature-preview img { height: 45px; }

.modal { position: fixed; inset: 0; z-index: 100; background: rgba(15, 23, 42, .48); display: grid; place-items: center; padding: 20px; backdrop-filter: blur(4px); }
.modal-card { width: min(980px, 96vw); max-height: 92vh; overflow: auto; background: #fff; border-radius: 16px; box-shadow: 0 30px 100px rgba(0,0,0,.25); }
.modal-header { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 18px 21px; background: #fff; border-bottom: 1px solid var(--border); }
.modal-header h3 { margin: 0 0 2px; }
.modal-header p { margin: 0; color: var(--muted); font-size: 11px; }
.modal-body { padding: 20px; }
.modal-actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 9px; padding: 14px 20px; background: #fff; border-top: 1px solid var(--border); }
.modal-section { margin-bottom: 20px; }
.modal-section:last-child { margin-bottom: 0; }
.modal-section h4 { margin-bottom: 10px; font-size: 14px; }
.request-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin-bottom: 20px; }
.summary-box { border: 1px solid var(--border); border-radius: 9px; padding: 10px; }
.summary-box span, .detail-grid span { display: block; color: var(--muted); font-size: 10px; margin-bottom: 3px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.detail-grid > div { border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.pricing-summary { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--border); border-radius: 9px; overflow: hidden; margin-top: 14px; }
.pricing-summary > div { padding: 10px; border-left: 1px solid var(--border); }
.pricing-summary > div:first-child { border-left: 0; }
.pricing-summary span, .pricing-summary strong { display: block; }
.pricing-summary span { color: var(--muted); font-size: 10px; }
.pricing-summary strong { margin-top: 3px; }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 200; max-width: 420px; padding: 12px 16px; color: #fff; background: #344054; border-radius: 10px; box-shadow: 0 14px 40px rgba(0,0,0,.2); opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.toast.visible { opacity: 1; transform: none; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

@media (max-width: 1100px) {
  .application { grid-template-columns: 82px minmax(0, 1fr); }
  .sidebar-brand > div:last-child, .sidebar button span:last-child { display: none; }
  .sidebar-brand { justify-content: center; }
  .sidebar nav button, .sidebar-footer button { justify-content: center; }
  .nav-icon { width: auto; }
  .dashboard-grid, .request-layout { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .page-content { padding: 18px; }
  .topbar { padding: 0 18px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .dashboard-heading { align-items: flex-start; flex-direction: column; }
  .form-grid, .request-summary-grid, .pricing-summary { grid-template-columns: 1fr; }
  .full-field { grid-column: auto; }
  .pricing-summary > div { border-left: 0; border-top: 1px solid var(--border); }
  .pricing-summary > div:first-child { border-top: 0; }
  .filter-group, .toolbar { align-items: stretch; flex-direction: column; }
  .filter-group input, .filter-group select { max-width: none; width: 100%; }
  .backup-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .application { display: block; padding-bottom: 70px; }
  .sidebar { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: 100%; height: 66px; padding: 7px; border-right: 0; border-top: 1px solid var(--border); }
  .sidebar-brand, .sidebar-footer, .sidebar nav button:nth-child(n+6) { display: none !important; }
  .sidebar nav { display: grid; grid-template-columns: repeat(5, 1fr); padding: 0; overflow: visible; gap: 2px; }
  .sidebar nav button { display: grid; place-items: center; gap: 1px; padding: 5px 2px; font-size: 9px; }
  .sidebar nav button span:last-child { display: block; }
  .nav-icon { font-size: 15px; }
  .topbar { height: 66px; }
  .topbar p, .profile-summary > div:first-child { display: none; }
  .page-content { padding: 14px; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metrics article { padding: 13px; }
  .metrics strong { font-size: 22px; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
  .product-image-frame { min-height: 140px; }
  .product-card-content { padding: 11px; min-height: 190px; }
  .product-card h4 { font-size: 14px; min-height: 37px; }
  .product-card p { font-size: 11px; min-height: 32px; max-height: 32px; }
  .product-card-actions { grid-template-columns: 58px minmax(0,1fr); gap: 6px; }
  .product-card-actions button { font-size: 11px; padding: 6px; }
  .modal { padding: 0; align-items: end; }
  .modal-card { width: 100%; max-height: 96vh; border-radius: 16px 16px 0 0; }
  .modal-body { padding: 16px; }
}

@media (max-width: 410px) {
  .product-grid { grid-template-columns: 1fr; }
  .product-image-frame { min-height: 210px; }
}
