:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --ink: #152033;
  --muted: #6a7487;
  --soft-muted: #9aa4b5;
  --line: #e4e9f1;
  --line-strong: #cdd6e3;
  --primary: #0b74de;
  --primary-dark: #075bb2;
  --primary-soft: #e9f3ff;
  --success: #16a06a;
  --success-soft: #e8f8f1;
  --warning: #d88a16;
  --warning-soft: #fff4df;
  --danger: #d64545;
  --danger-soft: #fff0f0;
  --sidebar: #0f172a;
  --sidebar-2: #111d35;
  --shadow: 0 14px 40px rgba(21, 32, 51, .08);
  --shadow-sm: 0 6px 18px rgba(21, 32, 51, .06);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(11, 116, 222, .08), transparent 34rem),
    var(--bg);
  font-size: 14px;
}

body[data-font="sarabun"] {
  font-family: "TH Sarabun New", "Sarabun", "Leelawadee UI", Tahoma, Arial, sans-serif;
  font-size: 15px;
}

body[data-font="kanit"] {
  font-family: "Kanit", "Trebuchet MS", "Segoe UI", Tahoma, Arial, sans-serif;
}

body[data-font="prompt"] {
  font-family: "Prompt", "Leelawadee UI", "Segoe UI", Tahoma, Arial, sans-serif;
}

body[data-theme="emerald"] {
  --primary: #0f9f74;
  --primary-dark: #087957;
  --primary-soft: #e7f8f2;
  --sidebar: #0d1f1b;
  --sidebar-2: #102b25;
}

body[data-theme="indigo"] {
  --primary: #635bff;
  --primary-dark: #4338ca;
  --primary-soft: #eef0ff;
  --sidebar: #171532;
  --sidebar-2: #1d1a42;
}

body[data-theme="graphite"] {
  --primary: #334155;
  --primary-dark: #1f2937;
  --primary-soft: #f1f5f9;
  --sidebar: #111827;
  --sidebar-2: #1f2937;
}

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

button,
a,
label {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  font-size: 17px;
  line-height: 1.35;
  letter-spacing: 0;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 18px;
  color: #e8edf7;
  background:
    linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  box-shadow: 8px 0 32px rgba(15, 23, 42, .14);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 6px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .10);
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #22a7f0, #086ad8);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(8, 106, 216, .32);
}

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

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

.brand span {
  margin-top: 2px;
  color: #9fb0cc;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav::before {
  content: "เมนูหลัก";
  color: #8190aa;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  margin: 2px 8px 6px;
  text-transform: uppercase;
}

.nav-btn {
  position: relative;
  border: 0;
  border-radius: 10px;
  color: #cbd6ea;
  background: transparent;
  padding: 12px 14px 12px 38px;
  min-height: 44px;
  text-align: left;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.nav-btn::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 2px solid currentColor;
  transform: translateY(-50%);
  opacity: .72;
}

.nav-btn.active,
.nav-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, .10);
}

.nav-btn.active {
  box-shadow: inset 3px 0 0 #33b5ff;
}

.primary,
.ghost,
.danger,
.file-btn,
.small-btn {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 40px;
  padding: 9px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: background .16s ease, border .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.primary {
  color: #fff;
  background: linear-gradient(180deg, #1486f5, var(--primary));
  box-shadow: 0 10px 22px rgba(11, 116, 222, .22);
}

.primary:hover {
  background: linear-gradient(180deg, #0b74de, var(--primary-dark));
  transform: translateY(-1px);
}

.ghost,
.file-btn,
.small-btn {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.ghost:hover,
.file-btn:hover,
.small-btn:hover {
  border-color: #b9c7da;
  box-shadow: var(--shadow-sm);
}

.danger {
  color: #fff;
  background: linear-gradient(180deg, #e05252, var(--danger));
}

.full {
  width: 100%;
}

.session-box {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, .12);
  padding: 14px 6px 0;
  display: grid;
  gap: 10px;
  color: #cbd6ea;
  font-size: 13px;
}

.session-box span {
  color: #9fb0cc;
}

.session-box a {
  color: #fff;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 8px;
  padding: 8px 10px;
  text-align: center;
  background: rgba(255, 255, 255, .06);
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin: -28px -28px 22px;
  padding: 24px 28px 20px;
  background: rgba(246, 248, 251, .92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(228, 233, 241, .82);
}

.topbar p {
  color: var(--muted);
  margin-top: 5px;
}

.top-actions,
.form-actions,
.panel-head,
.pager,
.print-options {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.file-btn,
.import-label {
  position: relative;
  overflow: hidden;
}

.file-btn input,
.import-label input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.workflow-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.workflow-strip div {
  position: relative;
  padding: 15px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.workflow-strip div::after {
  content: "";
  position: absolute;
  right: -10px;
  top: 50%;
  width: 18px;
  height: 18px;
  background: #fff;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  transform: translateY(-50%) rotate(45deg);
  z-index: 1;
}

.workflow-strip div:last-child::after {
  display: none;
}

.workflow-strip strong,
.workflow-strip span {
  display: block;
}

.workflow-strip strong {
  color: var(--primary-dark);
  font-size: 14px;
}

.workflow-strip span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  min-height: 122px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -34px;
  top: -34px;
  width: 92px;
  height: 92px;
  border-radius: 999px;
  background: var(--primary-soft);
}

.stat-card:nth-child(2)::after {
  background: var(--warning-soft);
}

.stat-card:nth-child(3)::after {
  background: var(--success-soft);
}

.stat-card:nth-child(4)::after {
  background: #eef2ff;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.stat-card strong {
  display: block;
  margin-top: 14px;
  font-size: 28px;
  line-height: 1;
}

.toolbar,
.panel,
.table-wrap {
  background: rgba(255, 255, 255, .96);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.toolbar {
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 210px 170px;
  gap: 14px;
  margin-bottom: 16px;
}

#dashboardView .toolbar {
  grid-template-columns: auto minmax(220px, 1fr) 150px 130px;
  align-items: end;
}

.compact-toolbar {
  grid-template-columns: minmax(240px, 1fr) 160px;
  align-items: end;
}

.field {
  display: grid;
  gap: 7px;
}

.field label,
.install-form label {
  color: #566174;
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: none;
  transition: border .16s ease, box-shadow .16s ease, background .16s ease;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(11, 116, 222, .13);
}

input::placeholder,
textarea::placeholder {
  color: var(--soft-muted);
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

table {
  width: 100%;
  min-width: 840px;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  color: #667085;
  background: #f9fbfe;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
}

tbody tr {
  transition: background .16s ease;
}

tbody tr:hover {
  background: #fbfdff;
}

tr:last-child td {
  border-bottom: 0;
}

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

.right {
  text-align: right;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 5px 11px;
  color: #075bb2;
  background: var(--primary-soft);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-color-0 { --status-bg: #eaf2ff; --status-fg: #0b5cad; --status-border: #b9d7ff; }
.status-color-1 { --status-bg: #fff7e6; --status-fg: #a05a00; --status-border: #ffd897; }
.status-color-2 { --status-bg: #eefaf2; --status-fg: #147a3c; --status-border: #b9e8c7; }
.status-color-3 { --status-bg: #f3edff; --status-fg: #6842b8; --status-border: #d6c6ff; }
.status-color-4 { --status-bg: #fff0f3; --status-fg: #b4234d; --status-border: #ffc2d0; }
.status-color-5 { --status-bg: #ecfeff; --status-fg: #087281; --status-border: #a5f3fc; }
.status-color-6 { --status-bg: #f5f5f4; --status-fg: #57534e; --status-border: #d6d3d1; }
.status-color-7 { --status-bg: #f0fdf4; --status-fg: #166534; --status-border: #bbf7d0; }

.status-pill[class*="status-color-"],
.status-choice[class*="status-color-"],
.status-tab[class*="status-color-"] {
  color: var(--status-fg);
  background: var(--status-bg);
  border-color: var(--status-border);
}

.status-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 2px 0 16px;
}

.status-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 800;
  cursor: pointer;
}

.status-tab strong {
  min-width: 24px;
  border-radius: 999px;
  padding: 2px 7px;
  background: rgba(255,255,255,.72);
}

.status-tab.active {
  box-shadow: 0 0 0 2px rgba(15, 23, 42, .08);
  transform: translateY(-1px);
}

.status-tab.status-all {
  color: #0f172a;
  background: #f8fafc;
  border-color: #dbe3ef;
}

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

.small-btn {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.pager {
  justify-content: flex-end;
  margin-top: 12px;
  color: var(--muted);
}

.tabs-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 14px;
  scrollbar-width: thin;
}

.tab-btn {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-weight: 700;
}

.tab-btn.active,
.tab-btn:hover {
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-color: rgba(11, 116, 222, .25);
}

.product-toolbar {
  grid-template-columns: minmax(260px, 1fr) 180px;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.panel {
  padding: 20px;
}

.panel-head {
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel-head h2 {
  display: flex;
  align-items: center;
  gap: 9px;
}

.panel-head h2::before,
.panel > h2::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 18px;
  border-radius: 999px;
  background: var(--primary);
  vertical-align: middle;
  margin-right: 9px;
}

.panel-head span {
  color: var(--muted);
  font-size: 13px;
}

.span-2 {
  grid-column: 1 / -1;
}

.grid-2,
.grid-4 {
  display: grid;
  gap: 12px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.items {
  display: grid;
  gap: 10px;
}

.item-row {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) 90px 110px 130px 130px 42px;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcff;
}

.item-row.compact-row {
  align-items: center;
  padding-top: 10px;
}

.item-row.compact-row .field label {
  display: none;
}

.icon-btn {
  border: 0;
  background: transparent;
  color: #667085;
  font-size: 26px;
  line-height: 1;
}

.icon-btn:hover {
  color: var(--danger);
}

.totals {
  display: grid;
  grid-template-columns: 150px 150px 190px minmax(260px, 1fr);
  gap: 12px;
  align-items: start;
  margin-top: 16px;
}

.danger-text {
  color: var(--danger);
  border-color: rgba(220, 38, 38, .25);
  background: #fff5f5;
}

#deleteJobBtn {
  display: none !important;
}

.queue-customer-name {
  display: inline-block;
  color: #475569;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
}

.queue-job-type {
  color: #475569;
  font-size: 14px;
  font-weight: 700;
}


.print-bottom-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line);
  background: #fff;
  position: sticky;
  bottom: 0;
  z-index: 2;
}

.print-bottom-actions button {
  min-width: 120px;
}

.copy-link-btn::before {
  content: "⧉";
  margin-right: 6px;
}

.modern-doc .doc-header.pro {
  border-bottom: 0;
  padding-bottom: 24px;
}

.modern-doc .doc-date {
  margin-top: 8px;
  color: #64748b;
  font-size: 13px;
}

.modern-doc .customer-doc-grid {
  grid-template-columns: 1fr;
}

.modern-doc .deposit-line strong {
  color: #0b74de;
}

.summary-box {
  justify-self: end;
  min-width: 310px;
  padding: 14px;
  background: #f8fbff;
  border: 1px solid #cfe0f5;
  border-radius: 10px;
}

.summary-line {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 8px;
  color: #445066;
}

.summary-line strong {
  color: var(--ink);
}

.summary-line.total {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #cfe0f5;
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
}

.image-list,
.asset-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(124px, 1fr));
  gap: 10px;
}

.image-list img,
.asset-preview img {
  width: 100%;
  max-width: 100%;
  height: 104px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.asset-preview div {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.appearance-preview {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid rgba(11, 116, 222, .22);
  border-radius: 12px;
  background:
    linear-gradient(135deg, var(--primary-soft), #fff);
}

.appearance-preview span,
.appearance-preview strong,
.appearance-preview p {
  display: block;
}

.appearance-preview span {
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
}

.appearance-preview strong {
  margin-top: 6px;
  color: var(--ink);
  font-size: 20px;
}

.appearance-preview p {
  margin-top: 6px;
  color: var(--muted);
}

.switch-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.switch-grid label,
.print-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.switch-grid input,
.print-options input {
  width: auto;
  min-height: auto;
}

dialog {
  width: min(1060px, calc(100vw - 28px));
  border: 0;
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 22px 70px rgba(15, 23, 42, .24);
}

#statusDialog {
  width: min(420px, calc(100vw - 28px));
}

#queueDialog {
  width: min(720px, calc(100vw - 28px));
}

#queueStatusDialog {
  width: min(420px, calc(100vw - 28px));
}

.compact-action {
  align-self: end;
  white-space: nowrap;
  min-height: 36px;
  padding: 8px 12px;
  font-size: 13px;
}

.queue-status-btn {
  cursor: pointer;
  border: 0;
  min-width: 104px;
}

.queue-actions {
  align-items: center;
}

.primary-mini {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

dialog::backdrop {
  background: rgba(15, 23, 42, .52);
}

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

.print-options {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: #f8fbff;
}

.dialog-body {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px 20px;
  border-top: 1px solid var(--line);
}

.status-choice-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 14px 16px 18px;
}

.status-choice {
  width: 100%;
  display: grid;
  gap: 4px;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  text-align: center;
}

.status-choice:hover,
.status-choice.active {
  border-color: rgba(11, 116, 222, .35);
  background: var(--primary-soft);
}

.status-choice span {
  font-weight: 800;
  font-size: 13px;
}

.status-choice strong {
  color: var(--primary-dark);
  font-size: 11px;
}

.status-choice[class*="status-color-"] {
  color: var(--status-fg);
  background: var(--status-bg);
  border-color: var(--status-border);
}

.status-choice[class*="status-color-"].active,
.status-choice[class*="status-color-"]:hover {
  box-shadow: 0 0 0 2px var(--status-border);
}

.status-choice[class*="status-color-"] strong {
  color: var(--status-fg);
}

.status-action {
  border: 0;
  cursor: pointer;
}

.status-action:hover {
  box-shadow: 0 0 0 3px rgba(11, 116, 222, .12);
}

.settings-tools-panel .top-actions {
  justify-content: flex-start;
  padding-top: 4px;
}

.settings-tools-panel .ghost,
.settings-tools-panel .file-btn {
  min-height: 38px;
}

.print-area {
  padding: 26px;
  background: #eef3f9;
  max-height: calc(100vh - 210px);
  overflow: auto;
}

.document {
  width: 794px;
  min-height: 1123px;
  margin: 0 auto;
  padding: 44px;
  color: #111827;
  background: #fff;
  box-shadow: 0 14px 40px rgba(15, 23, 42, .16);
}

.doc-header {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 210px;
  gap: 18px;
  align-items: start;
  padding-bottom: 18px;
  border-bottom: 3px solid var(--primary);
}

.doc-logo {
  width: 84px;
  height: 84px;
  object-fit: contain;
  background: #fff;
  border: 1px solid #d9e1ec;
  border-radius: 8px;
}

.doc-title {
  color: var(--primary-dark);
  text-align: right;
  font-size: 28px;
  font-weight: 900;
}

.doc-meta,
.doc-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 18px;
}

.doc-box {
  min-height: 96px;
  padding: 13px;
  background: #fbfcff;
  border: 1px solid #d9e1ec;
  border-radius: 8px;
}

.doc-table {
  min-width: 0;
  margin-top: 18px;
  border: 1px solid #d9e1ec;
}

.doc-table th {
  color: #334155;
  background: #eef5ff;
}

.doc-table th,
.doc-table td {
  border-bottom: 1px solid #d9e1ec;
}

.doc-footer {
  margin-top: 34px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 34px;
  align-items: end;
}

.sign-box {
  min-height: 132px;
  padding-top: 10px;
  text-align: center;
  border-top: 1px solid #223047;
}

.sign-box img {
  max-width: 180px;
  max-height: 72px;
  object-fit: contain;
}

.stamp-img {
  max-height: 92px;
  opacity: .84;
}

.doc-header.pro {
  grid-template-columns: minmax(0, 1fr) 240px;
  align-items: start;
}

.doc-brand-block {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 16px;
}

.doc-brand-block p,
.doc-heading-block p,
.doc-box p,
.doc-note-pro p {
  margin: 4px 0 0;
  color: #4b5563;
}

.text-logo {
  display: grid;
  place-items: center;
  color: var(--primary-dark);
  background: var(--primary-soft);
  font-weight: 900;
}

.doc-heading-block {
  text-align: right;
}

.doc-number {
  margin-top: 8px;
  display: inline-flex;
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  font-weight: 800;
}

.doc-info-grid {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 16px;
  margin-top: 20px;
}

.doc-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.doc-note-pro,
.doc-work-images {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #d9e1ec;
  border-radius: 8px;
  background: #fbfcff;
}

.document.clean {
  padding: 48px 52px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .14);
}

.document.clean .doc-header.pro {
  padding-bottom: 22px;
  border-bottom: 0;
}

.document.clean .doc-title {
  color: #0f172a;
  font-size: 28px;
  letter-spacing: 0;
}

.document.clean:not(.doc-work) .doc-title {
  font-size: 24px;
}

.document.clean .doc-number {
  color: var(--primary-dark);
  background: transparent;
  border-radius: 0;
  padding: 0;
}

.document.clean .doc-box,
.document.clean .doc-note-pro,
.document.clean .doc-work-images {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.document.clean .doc-info-grid {
  grid-template-columns: 1fr 1fr;
  gap: 34px;
  padding-top: 18px;
  border-top: 1px solid #e5e7eb;
}

.document.clean .doc-section-title {
  margin: 26px 0 10px;
  color: #0f172a;
  font-size: 14px;
  font-weight: 900;
}

.document.clean .doc-table.pro {
  border: 0;
  margin-top: 8px;
}

.document.clean .doc-table.pro th {
  color: #64748b;
  background: transparent;
  border-bottom: 1px solid #e5e7eb;
}

.document.clean .doc-table.pro td {
  border-bottom: 0;
  padding-top: 12px;
  padding-bottom: 12px;
}

.document.clean .doc-table.pro tbody tr + tr td {
  border-top: 1px solid #f1f5f9;
}

.document.clean .doc-total-card {
  border: 0;
  background: #f8fafc;
  box-shadow: none;
}

.document.clean .doc-footer.pro {
  margin-top: 48px;
  border-top: 1px solid #e5e7eb;
  padding-top: 34px;
}

.document.clean .sign-box {
  border-top: 0;
  color: #475569;
}

.doc-total-card {
  width: 320px;
  margin: 18px 0 0 auto;
  padding: 14px;
  border: 1px solid #cfe0f5;
  border-radius: 10px;
  background: #f8fbff;
}

.doc-total-card .summary-line.total {
  font-size: 14px;
  margin-top: 8px;
  padding-top: 10px;
}

.doc-total-card .summary-line.total strong {
  font-size: 18px;
}

.sign-date {
  margin-top: 22px;
  color: #64748b;
  font-size: 12px;
  font-weight: 500;
}

.doc-footer.pro .sign-box span {
  display: block;
  color: #4b5563;
  font-weight: 700;
}

.empty {
  color: var(--muted);
  padding: 22px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  max-width: 360px;
  padding: 13px 16px;
  color: #fff;
  background: #111827;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .22);
  opacity: 0;
  transform: translateY(12px);
  transition: .2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.install-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at top left, rgba(11, 116, 222, .13), transparent 34rem),
    linear-gradient(135deg, #f8fbff, #eef4fb);
}

.install-card {
  width: min(780px, 100%);
  padding: 30px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.login-card {
  width: min(430px, 100%);
}

.install-card h1 {
  margin-bottom: 6px;
}

.install-card p {
  color: var(--muted);
  margin-bottom: 20px;
}

.install-form {
  display: grid;
  gap: 14px;
}

.install-form h2 {
  margin-top: 12px;
  padding-top: 16px;
  color: #26344d;
  border-top: 1px solid var(--line);
}

.install-form label {
  display: grid;
  gap: 7px;
}

.notice {
  border-radius: 10px;
  padding: 12px 14px;
  margin: 14px 0;
}

.notice.success {
  color: #17633f;
  background: var(--success-soft);
}

.notice.error {
  color: #a12828;
  background: var(--danger-soft);
}

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

  .toolbar,
  .totals,
  .workflow-strip {
    grid-template-columns: 1fr;
  }

  .workflow-strip div::after {
    display: none;
  }

  .summary-box {
    justify-self: stretch;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav {
    grid-template-columns: repeat(2, 1fr);
  }

  .topbar {
    position: static;
    display: grid;
    margin: 0 0 18px;
    padding: 0;
    background: transparent;
    border: 0;
  }

  .main {
    padding: 18px;
  }

  .form-grid,
  .grid-4,
  .switch-grid {
    grid-template-columns: 1fr;
  }

  .item-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .stats-grid,
  .grid-2,
  .doc-meta,
  .doc-parties,
  .doc-footer {
    grid-template-columns: 1fr;
  }

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

  .item-row {
    grid-template-columns: 1fr;
  }

  .document {
    width: 100%;
    min-width: 0;
    padding: 24px;
  }

  .doc-header {
    grid-template-columns: 1fr;
  }

  .doc-title {
    text-align: left;
  }
}

@media print {
  body * {
    visibility: hidden;
  }

  #printArea,
  #printArea * {
    visibility: visible;
  }

  #printArea {
    position: absolute;
    inset: 0;
    padding: 0;
    background: white;
    overflow: visible;
  }

  .document {
    width: 100%;
    min-height: auto;
    margin: 0;
    padding: 34px;
    box-shadow: none;
  }
}
