:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #eef3f7;
  --ink: #17202f;
  --muted: #647386;
  --line: #dce5ef;
  --accent: #0f8b8d;
  --accent-dark: #0b6f71;
  --blue: #3267d6;
  --green: #1f9d63;
  --red: #d94b4b;
  --amber: #b7791f;
  --shadow: 0 18px 42px rgba(25, 38, 61, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

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

.app.locked {
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 22px 18px;
  background: #10202f;
  color: #f9fbfe;
}

.brand,
.profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo,
.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-size: 13px;
  font-weight: 900;
}

.brand span,
.profile span,
.sidebar-card span,
.sidebar-card p {
  display: block;
  color: #9fb1c5;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 6px;
  margin-top: 28px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 41px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  background: transparent;
  color: #bfd0e1;
  font-weight: 750;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.sidebar-card {
  margin-top: auto;
  margin-bottom: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-card strong {
  display: block;
  margin: 8px 0;
  font-size: 22px;
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #47c7b8;
}

.profile {
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.kicker {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 3vw, 42px);
  letter-spacing: 0;
}

h2 {
  margin-bottom: 4px;
  font-size: 18px;
}

.topbar-actions,
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar {
  justify-content: space-between;
  margin-bottom: 14px;
}

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

.warehouse-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(430px, 32vw);
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.warehouse-search {
  width: min(460px, 38vw);
}

.table-note {
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.empty-row {
  padding: 18px !important;
  color: var(--muted);
  text-align: center;
}

.primary-btn,
.secondary-btn,
.icon-btn,
.file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 800;
  white-space: nowrap;
}

.primary-btn {
  background: var(--accent);
  color: white;
}

.secondary-btn,
.icon-btn,
.file-btn {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.icon-btn {
  width: 42px;
  padding: 0;
}

.small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

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

.full {
  width: 100%;
}

.file-btn input {
  display: none;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.metrics,
.dashboard-grid,
.showroom-layout,
.support-layout,
.security-layout,
.report-grid {
  display: grid;
  gap: 16px;
}

.metrics {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  margin-bottom: 16px;
}

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

.accounting-profit-metrics {
  margin-top: 16px;
}

.accounting-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.85fr);
  gap: 16px;
  margin-bottom: 16px;
}

.dashboard-grid,
.showroom-layout,
.support-layout,
.workspace-layout,
.security-layout {
  grid-template-columns: minmax(0, 1.5fr) minmax(330px, 0.9fr);
}

.workspace-layout {
  display: grid;
  gap: 16px;
}

.work-profile {
  margin-bottom: 16px;
}

.work-profile-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.work-profile-item,
.daily-customer-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--surface) 90%, var(--surface-2));
}

.work-profile-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.employee-photo-uploader {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.employee-photo-preview,
.employee-avatar {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  place-items: center;
  width: 54px;
  height: 54px;
  min-width: 54px;
  max-width: 54px;
  min-height: 54px;
  max-height: 54px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 900;
}

.employee-photo-preview {
  width: 76px;
  height: 76px;
  min-width: 76px;
  max-width: 76px;
  min-height: 76px;
  max-height: 76px;
}

img.employee-avatar,
.employee-photo-preview img {
  display: block;
  width: 54px;
  height: 54px;
  min-width: 54px;
  max-width: 54px;
  min-height: 54px;
  max-height: 54px;
  object-fit: cover;
  object-position: center;
  border-radius: 50%;
}

.employee-avatar.small {
  width: 42px;
  height: 42px;
  min-width: 42px;
  max-width: 42px;
  min-height: 42px;
  max-height: 42px;
  font-size: 12px;
}

img.employee-avatar.small {
  width: 42px;
  height: 42px;
  min-width: 42px;
  max-width: 42px;
  min-height: 42px;
  max-height: 42px;
}

.employee-photo-preview img {
  width: 76px;
  height: 76px;
  min-width: 76px;
  max-width: 76px;
  min-height: 76px;
  max-height: 76px;
}

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

.birthday-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: color-mix(in srgb, var(--surface) 88%, var(--surface-2));
}

.birthday-card strong,
.birthday-card span {
  display: block;
}

.db-actions {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.security-layout .panel:first-child {
  grid-row: span 2;
}

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

.wide {
  grid-column: span 2;
}

.panel,
.metric,
.quick-card,
.deal-card,
.task-card,
.role-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric,
.panel {
  padding: 18px;
}

.metric span,
.metric em,
.panel-head p,
td,
.activity p,
.rank-row span,
.quick-card span,
.order-row span,
.history-row span,
.history-row em,
.ticket p,
.task-card span,
.task-card p,
.role-card span,
.role-card p,
.empty {
  color: var(--muted);
}

.metric strong {
  display: block;
  margin: 10px 0 8px;
  font-size: 26px;
}

.metric em {
  font-style: normal;
  font-size: 13px;
  font-weight: 700;
}

.good {
  color: var(--green) !important;
}

.bad {
  color: var(--red) !important;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.panel-head p {
  margin-bottom: 0;
  font-size: 13px;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  align-items: end;
  gap: 14px;
  height: 300px;
  padding-top: 28px;
}

.bar-chart div {
  position: relative;
  min-height: 28px;
  height: var(--h);
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, #54b6a9, #0f8b8d);
}

.bar-chart span,
.bar-chart b {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
}

.bar-chart span {
  bottom: -25px;
  color: var(--muted);
  font-weight: 800;
}

.bar-chart b {
  top: -24px;
  color: var(--ink);
  font-weight: 800;
}

.activity-list,
.rank-list,
.history-list,
.ticket-list,
.order-list,
.detail-list,
.role-list {
  display: grid;
  gap: 12px;
}

.activity,
.rank-row,
.history-row,
.order-row,
.ticket,
.detail-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: color-mix(in srgb, var(--surface) 86%, var(--surface-2));
}

.activity {
  align-items: flex-start;
  justify-content: flex-start;
}

.activity p {
  margin-bottom: 0;
  font-size: 13px;
}

.dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
}

.dot.red {
  background: var(--red);
}

.dot.blue {
  background: var(--blue);
}

.dot.green {
  background: var(--green);
}

.segmented {
  display: inline-flex;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
  background: var(--surface);
}

.segmented button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.segmented button.active {
  background: var(--accent);
  color: white;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(6, minmax(220px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.kanban-col {
  min-width: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-2);
}

.kanban-col header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-weight: 900;
}

.deal-card {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 12px;
  box-shadow: none;
}

.deal-card div {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.table-wrap.flat {
  box-shadow: none;
}

table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.accounting-total-row td {
  font-weight: 900;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.money-positive {
  color: var(--green);
  font-weight: 900;
}

.money-negative {
  color: var(--red);
  font-weight: 900;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.badge.danger {
  background: color-mix(in srgb, var(--red) 14%, var(--surface));
  color: var(--red);
}

.badge.warning {
  background: color-mix(in srgb, var(--amber) 14%, var(--surface));
  color: var(--amber);
}

.badge.success {
  background: color-mix(in srgb, var(--green) 14%, var(--surface));
  color: var(--green);
}

.delivery-control-panel {
  margin-bottom: 14px;
}

.delivery-filter-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(180px, 0.65fr) minmax(180px, 0.65fr) auto;
  gap: 12px;
  align-items: end;
}

.delivery-filter-grid label:not(.search) {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.delivery-filter-grid select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--ink);
}

.delivery-search {
  width: 100%;
}

.product-grid,
.task-grid,
.kpi-board,
.sales-target-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.product-thumb {
  display: block;
  width: 54px;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-2);
}

.image-empty {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.image-preview {
  display: grid;
  place-items: center;
  min-height: 120px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 86%, var(--surface-2));
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
}

.image-preview img {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  background: var(--surface);
}

.quick-card,
.task-card,
.kpi-card,
.role-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  box-shadow: none;
}

.task-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.workspace-card {
  align-content: start;
}

.permission-matrix {
  display: grid;
  gap: 12px;
}

.permission-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: color-mix(in srgb, var(--surface) 88%, var(--surface-2));
}

.permission-card span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

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

.permission-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.permission-check input {
  width: 16px;
  height: 16px;
}

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

.employee-kpi-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
}

.employee-kpi-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.employee-kpi-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.employee-kpi-head b {
  color: var(--accent-dark);
  font-size: 26px;
}

.employee-kpi-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.employee-kpi-stats span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.employee-kpi-stats strong {
  color: var(--ink);
}

.kpi-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.sales-target-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
}

.sales-target-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.sales-target-card header span,
.sales-target-card p {
  color: var(--muted);
}

.sales-target-list {
  display: grid;
  gap: 7px;
}

.sales-target-list div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 7px;
  font-size: 13px;
}

.kpi-card span,
.kpi-card p {
  color: var(--muted);
}

.kpi-metrics {
  display: grid;
  gap: 5px;
  font-size: 13px;
  font-weight: 750;
}

.progress.light {
  background: var(--surface-2);
}

.task-card label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.task-card input,
.task-card select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 8px;
  background: var(--surface);
  color: var(--ink);
}

.quick-card b {
  font-size: 18px;
}

.history-panel {
  margin-top: 16px;
}

.history-row {
  display: grid;
  grid-template-columns: 120px 1fr auto;
}

.qr-code {
  width: 92px;
  height: 92px;
  padding: 8px;
  background: white;
  fill: #111;
}

.task-card .qr-code {
  width: 112px;
  height: 112px;
}

.ticket {
  display: grid;
  grid-template-columns: 1fr auto auto;
}

.modal {
  width: min(640px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 30px 80px rgba(9, 17, 28, 0.28);
}

.preview-modal {
  width: min(860px, calc(100vw - 32px));
}

.invoice-preview {
  max-height: min(65vh, 680px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: #eef2f7;
}

.invoice-doc {
  position: relative;
  display: grid;
  gap: 8px;
  overflow: hidden;
  padding: 10px;
}

.invoice-doc table,
.invoice-body table {
  min-width: 0;
  margin-top: 10px;
}

.invoice-body {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
}

.company-header {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--line);
  padding-bottom: 14px;
}

.company-header h2 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 20px;
  text-transform: uppercase;
}

.company-header p {
  margin: 2px 0;
  color: var(--muted);
  font-size: 13px;
}

.company-header-logo {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-dark);
  font-weight: 900;
  overflow: hidden;
}

.company-header-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.watermark-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 0;
  width: min(460px, 72%);
  max-height: 460px;
  transform: translate(-50%, -50%);
  object-fit: contain;
  opacity: 0.055;
  pointer-events: none;
}

.invoice-a4 {
  width: min(794px, 100%);
  min-height: 1123px;
  margin: 0 auto;
  border: 0;
  border-radius: 0;
  padding: 20px 24px 32px;
  background: white;
  color: #202936;
  font-family: Arial, sans-serif;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
}

.print-a4 {
  position: relative;
  width: min(794px, 100%);
  min-height: 1123px;
  margin: 0 auto;
  padding: 28px 32px 36px;
  overflow: hidden;
  background: #fff;
  color: #202936;
  font-family: Arial, sans-serif;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
}

.print-a4 > h1 {
  position: relative;
  z-index: 1;
  margin: 16px 0 18px;
  color: #202936;
  text-align: center;
  font-size: 24px;
  text-transform: uppercase;
}

.print-a4 table {
  position: relative;
  z-index: 1;
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.print-a4 th,
.print-a4 td {
  border-bottom: 1px solid #e1e6ee;
  padding: 9px 8px;
  color: #202936;
  text-align: left;
  font-size: 12px;
}

.print-a4 th {
  background: #f1f5f9;
  font-weight: 800;
}

.print-a4 p {
  position: relative;
  z-index: 1;
  margin: 7px 0;
  color: #394658;
  line-height: 1.45;
}

.invoice-a4 .watermark-logo {
  width: min(420px, 58%);
  opacity: 0.045;
}

.invoice-a4-head {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 8px;
  align-items: stretch;
}

.invoice-company {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid #d8dee7;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.invoice-logo {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  overflow: hidden;
  border: 1px solid #d8dee7;
  border-radius: 8px;
  background: white;
  color: #1f2937;
  font-size: 13px;
  font-weight: 800;
}

.invoice-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 5px;
}

.invoice-company-main {
  min-width: 0;
}

.invoice-company-name {
  display: block;
  max-width: 100%;
  margin: 0 0 4px;
  color: #202936;
  font-size: 14px;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: nowrap;
}

.invoice-company-name.long {
  font-size: 13px;
}

.invoice-company-name.xlong {
  font-size: 12px;
}

.invoice-company-lines {
  display: grid;
  gap: 2px;
  color: #394658;
  font-size: 10px;
  line-height: 1.22;
}

.invoice-company-lines p,
.invoice-meta span,
.invoice-info-grid p,
.invoice-note p {
  margin: 0;
}

.invoice-company-lines span {
  margin-left: 32px;
}

.invoice-meta {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 3px;
  padding: 6px;
  border: 1px solid #d8dee7;
  border-radius: 8px;
  background: #f8fafc;
  color: #202936;
  font-size: 10px;
}

.invoice-meta-lines {
  display: grid;
  gap: 2px;
  width: 100%;
}

.invoice-meta strong {
  font-size: 11px;
}

.invoice-qr {
  display: grid;
  justify-items: center;
  gap: 2px;
  width: 70px;
  margin-top: 1px;
  color: #202936;
  text-align: center;
  font-size: 8px;
}

.invoice-qr .qr-code {
  width: 62px;
  height: 62px;
  padding: 3px;
  border: 1px solid #111827;
  border-radius: 2px;
  fill: #000;
}

.qr-link {
  display: grid;
  justify-items: center;
  gap: 2px;
  color: inherit;
  text-decoration: none;
}

.qr-fallback {
  display: grid;
}

.qr-code-img {
  object-fit: contain;
  background: #fff;
}

.qr-url {
  max-width: 116px;
  overflow-wrap: anywhere;
  color: #64748b;
  font-size: 7px;
  line-height: 1.1;
}

.print-preview-content {
  background: #eef2f7;
}

.print-preview-modal {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #eef2f7;
}

.print-preview-card {
  width: 100%;
  height: 100vh;
  max-height: none;
  border-radius: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 0;
}

.print-preview-card > .panel-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.print-preview-card > menu {
  margin: 0;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: #fff;
}

.print-preview-card .print-preview-content {
  height: 100%;
  max-height: none;
  overflow: auto;
  padding: 24px;
}

.print-preview-content .print-sheet,
.print-preview-content .invoice-a4 {
  margin: 0 auto;
}

.invoice-separator {
  position: relative;
  z-index: 1;
  margin: 12px 0 10px;
  border-top: 2px solid #202936;
}

.invoice-title {
  position: relative;
  z-index: 1;
  text-align: center;
}

.invoice-title h1 {
  margin: 0 0 10px;
  color: #202936;
  font-size: 27px;
  letter-spacing: 0;
}

.invoice-title p {
  margin: 0 0 18px;
  color: #394658;
  font-size: 13px;
}

.invoice-info-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 12px;
}

.invoice-info-grid-wide {
  grid-template-columns: 1.05fr 0.95fr 1.05fr;
  gap: 12px;
}

.invoice-info-grid article {
  min-height: 118px;
  border: 1px solid #d8dee7;
  border-radius: 8px;
  padding: 11px 12px;
  background: rgba(248, 250, 252, 0.82);
}

.invoice-info-grid h3 {
  margin: 0 0 7px;
  color: #202936;
  font-size: 14px;
}

.invoice-info-grid p {
  color: #394658;
  font-size: 13px;
  line-height: 1.35;
}

.invoice-items {
  position: relative;
  z-index: 1;
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  color: #202936;
  font-size: 12px;
}

.invoice-items th,
.invoice-items td {
  border: 0;
  border-bottom: 1px solid #e1e6ee;
  padding: 10px 8px;
  color: #202936;
}

.invoice-items th {
  font-size: 11px;
  text-transform: none;
  background: #f1f5f9;
  font-weight: 800;
}

.invoice-items th:nth-child(1),
.invoice-items td:nth-child(1),
.invoice-items th:nth-child(4),
.invoice-items td:nth-child(4),
.invoice-items th:nth-child(5),
.invoice-items td:nth-child(5) {
  text-align: center;
}

.invoice-items th:nth-child(6),
.invoice-items td:nth-child(6),
.invoice-items th:nth-child(7),
.invoice-items td:nth-child(7) {
  text-align: right;
}

.invoice-summary {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  justify-content: stretch;
  margin: 18px 0 24px auto;
  min-width: 310px;
  max-width: 360px;
  padding: 12px 14px;
  border: 1px solid #d8dee7;
  border-radius: 8px;
  background: #f8fafc;
  color: #202936;
}

.invoice-summary p,
.invoice-summary h2 {
  margin: 0;
}

.invoice-summary h2 {
  padding-top: 8px;
  border-top: 1px solid #d8dee7;
  font-size: 22px;
  text-align: right;
}

.invoice-summary p {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.invoice-note {
  position: relative;
  z-index: 1;
  min-height: 70px;
  border: 1px solid #e1e6ee;
  border-radius: 8px;
  padding: 12px 14px;
  color: #394658;
  font-size: 12px;
}

.invoice-amount-words {
  color: #202936;
  font-size: 13px;
}

.invoice-amount-words em {
  font-style: italic;
  font-weight: 800;
}

.invoice-signatures {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 26px;
  padding-top: 6px;
  min-height: 88px;
  color: #202936;
  text-align: center;
  font-size: 13px;
}

.print-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 18px 0;
}

.print-info-grid article {
  border: 1px solid #d8dee7;
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.print-info-grid h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.print-info-grid p {
  margin: 4px 0;
}

.order-view-page {
  min-height: 100vh;
  padding: 28px;
  background: #eef2f7;
  color: #202936;
}

.order-view-card {
  max-width: 980px;
  margin: 0 auto;
  border: 1px solid #d8dee7;
  border-radius: 8px;
  padding: 22px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
}

.order-view-head {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  align-items: center;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e1e6ee;
}

.order-view-head img,
.order-view-head > strong {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid #d8dee7;
  border-radius: 8px;
  object-fit: contain;
  font-weight: 900;
}

.order-view-head h1,
.order-view-title h2 {
  margin: 0;
}

.order-view-head p,
.order-view-title p,
.order-view-grid p,
.order-view-card footer {
  margin: 4px 0 0;
  color: #556274;
}

.order-view-title {
  margin: 18px 0;
}

.order-view-title span {
  color: #0f766e;
  font-weight: 800;
}

.order-view-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.order-view-grid article {
  border: 1px solid #e1e6ee;
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
}

.order-view-grid h3 {
  margin: 0 0 8px;
}

.order-view-items {
  width: 100%;
  border-collapse: collapse;
}

.order-view-items th,
.order-view-items td {
  border-bottom: 1px solid #e1e6ee;
  padding: 10px 8px;
  text-align: left;
}

.order-view-total {
  display: flex;
  justify-content: flex-end;
  gap: 18px;
  margin-top: 16px;
  font-size: 20px;
}

.order-view-card footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid #e1e6ee;
}

.modal::backdrop {
  background: rgba(11, 22, 34, 0.48);
}

.modal-card {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.polished-form {
  gap: 16px;
  width: min(920px, calc(100vw - 32px));
}

.sale-modal-full {
  width: min(1180px, calc(100vw - 24px));
  max-width: none;
  max-height: calc(100vh - 24px);
}

.sale-form-full {
  width: 100%;
  max-height: calc(100vh - 24px);
  overflow: auto;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.75fr);
  align-items: start;
  padding-bottom: 0;
}

.sale-form-full > .panel-head,
.sale-form-full > menu {
  grid-column: 1 / -1;
}

.sale-form-full > .form-section {
  min-height: 0;
}

.sale-form-full > .form-section:nth-of-type(2) {
  grid-row: span 2;
}

.sale-form-full .sale-items {
  max-height: calc(100vh - 330px);
  overflow: auto;
  padding-right: 4px;
}

.form-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.form-section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.form-section-title strong {
  color: var(--text);
  font-size: 15px;
}

.form-section-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.polished-form .sale-items-head {
  padding: 0;
  border: 0;
  background: transparent;
}

.polished-form menu {
  position: sticky;
  bottom: -20px;
  margin: 0 -20px -20px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

.modal-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.company-settings {
  max-width: 1180px;
}

.company-settings label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.company-settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 18px;
}

.settings-fields {
  display: grid;
  gap: 12px;
}

.company-file-btn {
  width: fit-content;
}

.company-settings .file-btn input {
  display: none;
}

.company-preview {
  display: grid;
  align-content: start;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: color-mix(in srgb, var(--surface) 86%, var(--surface-2));
}

.company-logo-preview {
  display: grid;
  place-items: center;
  min-height: 150px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
  font-weight: 800;
  overflow: hidden;
}

.company-logo-preview img {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
}

.company-preview-text {
  display: grid;
  gap: 5px;
}

.company-preview-text span {
  color: var(--muted);
  font-size: 13px;
}

.modal input,
.modal select,
.daily-report-form input,
.daily-report-form textarea,
.company-settings input,
.login-card input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--ink);
}

.daily-report-form {
  display: grid;
  gap: 12px;
}

.daily-report-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.daily-report-form textarea {
  min-height: 84px;
  padding: 10px;
  resize: vertical;
}

.customer-contact-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.daily-customers {
  display: grid;
  gap: 10px;
}

.daily-customer-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.15fr) minmax(110px, 0.8fr) minmax(130px, 1fr) minmax(115px, 0.8fr) minmax(130px, 0.9fr) 42px;
  gap: 10px;
  align-items: end;
}

.daily-customer-row label {
  gap: 5px;
}

.daily-report-list {
  display: grid;
  gap: 12px;
}

.daily-report-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
}

.daily-report-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.daily-report-card header span,
.daily-report-card p {
  color: var(--muted);
}

.daily-report-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.kpi-alerts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.daily-report-stats span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.daily-report-stats strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 18px;
}

.daily-customer-list {
  display: grid;
  gap: 6px;
  border-left: 3px solid var(--accent);
  padding-left: 10px;
}

.daily-customer-list p {
  margin: 0;
}

.sale-items-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.sale-item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 42px;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: color-mix(in srgb, var(--surface) 88%, var(--surface-2));
}

.sale-item-row .icon-btn {
  min-height: 40px;
}

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

menu {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 6px 0 0;
  padding: 0;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 15% 18%, rgba(21, 128, 61, 0.2), transparent 30%),
    linear-gradient(135deg, #0f172a 0%, #172033 48%, #0b1220 100%);
}

.login-screen.hidden {
  display: none;
}

.login-card {
  display: grid;
  gap: 15px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(360px, 420px);
  width: min(820px, 100%);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 96%, white);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.34);
}

.login-hero {
  display: grid;
  align-content: space-between;
  gap: 34px;
  min-height: 600px;
  padding: 34px;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(22, 101, 52, 0.82)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cg fill='none' stroke='rgba(255,255,255,.16)' stroke-width='1'%3E%3Cpath d='M0 30h180M0 90h180M0 150h180M30 0v180M90 0v180M150 0v180'/%3E%3C/g%3E%3C/svg%3E");
  color: white;
}

.official-login-hero {
  min-height: 430px;
}

.login-hero .brand-logo {
  background: white;
  color: #166534;
}

.login-hero .brand span,
.login-hero-copy p,
.login-feature-grid span {
  color: rgba(255, 255, 255, 0.78);
}

.login-hero-copy {
  display: grid;
  gap: 14px;
}

.login-kicker {
  width: fit-content;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.login-hero h1 {
  margin: 0;
  max-width: 520px;
  font-size: 34px;
  line-height: 1.12;
  letter-spacing: 0;
}

.login-hero p {
  margin: 0;
  max-width: 520px;
  line-height: 1.6;
}

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

.login-feature-grid div {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.08);
}

.login-feature-grid strong {
  font-size: 13px;
}

.login-feature-grid span {
  font-size: 12px;
  line-height: 1.35;
}

.login-card-head {
  display: grid;
  gap: 7px;
  margin-bottom: 6px;
}

.login-card-head span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.login-card-head h2 {
  margin: 0;
  font-size: 26px;
}

.login-card-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.login-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.password-field input {
  border: 0;
}

.password-field button {
  border: 0;
  border-left: 1px solid var(--line);
  padding: 0 12px;
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.login-help {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.login-footnote {
  margin: 0;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.login-error {
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fef2f2;
  color: #991b1b;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.js-error-panel {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9999;
  display: grid;
  gap: 4px;
  max-width: min(460px, calc(100vw - 32px));
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff7f7;
  color: #7f1d1d;
  padding: 12px 14px;
  box-shadow: 0 18px 42px rgba(25, 38, 61, 0.18);
  font-size: 13px;
}

.js-error-panel strong {
  font-size: 12px;
  text-transform: uppercase;
}

.js-error-panel span {
  word-break: break-word;
}

.login-help > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.demo-account-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.demo-account-grid button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.demo-account-grid button:hover,
.password-field button:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  transform: translateY(18px);
  opacity: 0;
  border-radius: 8px;
  padding: 12px 14px;
  background: #10202f;
  color: white;
  font-weight: 800;
  box-shadow: var(--shadow);
  transition: 180ms ease;
  pointer-events: none;
}

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

.print-area {
  display: none;
}

[data-icon] {
  display: inline-flex;
  width: 18px;
  height: 18px;
}

[data-icon] svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

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

  .login-shell {
    grid-template-columns: 1fr;
    max-width: 560px;
  }

  .login-hero {
    min-height: auto;
  }

  .login-feature-grid {
    grid-template-columns: 1fr;
  }

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

  .nav {
    grid-template-columns: repeat(12, minmax(135px, 1fr));
    overflow-x: auto;
  }

  .sidebar-card,
  .profile {
    display: none;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions,
  .search {
    width: 100%;
  }
}

@media (max-width: 780px) {
  html {
    -webkit-text-size-adjust: 100%;
  }

  body,
  .app,
  .main,
  .screen,
  .panel,
  .metric,
  .table-wrap {
    max-width: 100vw;
  }

  .main {
    width: 100%;
    min-width: 0;
    padding: 10px 10px 88px;
    overflow-x: hidden;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 10px 10px 8px;
    box-shadow: 0 10px 28px rgba(16, 32, 47, 0.16);
  }

  .sidebar .brand {
    align-items: center;
  }

  .sidebar .brand-logo {
    width: 38px;
    height: 38px;
  }

  .sidebar .brand strong {
    font-size: 15px;
  }

  .sidebar .brand span {
    display: none;
  }

  .nav {
    display: flex;
    gap: 6px;
    margin: 10px -10px 0;
    overflow-x: auto;
    padding: 0 10px 6px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    flex: 0 0 auto;
    min-width: 86px;
    min-height: 52px;
    flex-direction: column;
    gap: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 7px 9px;
    scroll-snap-align: start;
    white-space: nowrap;
    font-size: 11px;
    text-align: center;
  }

  .nav-item [data-icon] {
    width: 17px;
    height: 17px;
  }

  .topbar {
    gap: 12px;
    margin-bottom: 14px;
  }

  .kicker {
    font-size: 11px;
  }

  h1 {
    font-size: 25px;
    line-height: 1.18;
  }

  h2 {
    font-size: 16px;
  }

  .topbar-actions {
    gap: 8px;
  }

  .search {
    min-height: 46px;
    border-radius: 8px;
  }

  .login-screen {
    align-items: stretch;
    padding: 10px;
  }

  .login-hero,
  .login-card {
    padding: 18px;
  }

  .login-hero h1 {
    font-size: 26px;
  }

  .demo-account-grid {
    grid-template-columns: 1fr;
  }

  .metrics,
  .metrics.compact,
  .dashboard-grid,
  .dashboard-grid.lower,
  .showroom-layout,
  .support-layout,
  .workspace-layout,
  .security-layout,
  .accounting-layout,
  .company-settings-grid,
  .order-view-grid,
  .order-view-head,
  .sale-form-full,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .metrics,
  .metrics.compact {
    gap: 8px;
  }

  .delivery-filter-grid {
    grid-template-columns: 1fr;
  }

  .metric,
  .panel {
    border-radius: 8px;
    padding: 12px;
  }

  .metric strong {
    font-size: 22px;
    overflow-wrap: anywhere;
  }

  .metric span,
  .metric em,
  .panel-head p,
  .table-note {
    font-size: 12px;
  }

  .panel-head {
    align-items: flex-start;
    gap: 10px;
  }

  .panel-head .primary-btn,
  .panel-head .secondary-btn {
    width: auto;
    min-height: 38px;
    padding-inline: 12px;
  }

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

  table {
    min-width: 720px;
    font-size: 13px;
  }

  th,
  td {
    padding: 10px 9px;
  }

  .table-wrap.flat table,
  .invoice-doc table,
  .invoice-body table,
  .print-sheet table {
    min-width: 0;
  }

  .modal,
  .preview-modal,
  .sale-modal-full {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
  }

  .modal-card {
    width: 100%;
    max-height: 100dvh;
    min-height: 100dvh;
    border-radius: 0;
    padding: 14px 12px 90px;
    overflow: auto;
  }

  .modal-card > .panel-head {
    position: sticky;
    top: -14px;
    z-index: 2;
    margin: -14px -12px 14px;
    border-bottom: 1px solid var(--line);
    padding: 12px;
    background: var(--surface);
  }

  .modal-card menu {
    position: sticky;
    bottom: -90px;
    z-index: 2;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 18px -12px -90px;
    border-top: 1px solid var(--line);
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
    background: var(--surface);
  }

  .print-preview-modal {
    width: 100vw;
    max-width: 100vw;
  }

  .print-preview-card {
    height: 100dvh;
    min-height: 100dvh;
    border-radius: 0;
  }

  .print-preview-card .print-preview-content {
    padding: 10px;
    overflow: auto;
  }

  .print-preview-content .print-sheet,
  .print-preview-content .invoice-a4 {
    transform-origin: top left;
  }

  .print-preview-content .invoice-a4,
  .print-preview-content .print-sheet,
  .print-preview-content .print-a4 {
    width: 190mm;
    max-width: none;
    min-width: 190mm;
    transform: scale(calc((100vw - 20px) / 718));
    transform-origin: top left;
    margin: 0;
  }

  .print-preview-content {
    min-height: calc(277mm * ((100vw - 20px) / 718) + 20px);
  }

  .sale-form-full .sale-items {
    max-height: none;
  }

  .sale-modal-full .modal-card,
  .sale-form-full {
    min-height: 100dvh;
  }

  .sale-form-full .sale-items,
  .daily-customer-list {
    display: grid;
    gap: 8px;
  }

  .form-section {
    padding: 12px;
  }

  .form-section-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .sale-items-head,
  .customer-contact-head,
  .daily-report-card header {
    align-items: stretch;
    flex-direction: column;
  }

  .sale-item-row {
    grid-template-columns: minmax(0, 1fr) 92px 44px;
    gap: 8px;
    padding: 9px;
  }

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

  .order-view-card footer {
    display: grid;
  }

  .wide {
    grid-column: auto;
  }

  .topbar-actions,
  .toolbar,
  .toolbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-btn,
  .secondary-btn,
  .file-btn {
    width: 100%;
    min-height: 44px;
  }

  .icon-btn {
    width: 44px;
    min-width: 44px;
    height: 44px;
  }

  .kanban {
    grid-template-columns: repeat(6, 82vw);
  }

  .history-row,
  .ticket,
  .order-row,
  .activity,
  .rank-row,
  .detail-stat,
  .birthday-card,
  .sale-item-row,
  .daily-customer-row,
  .work-profile-grid {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .history-row,
  .ticket,
  .order-row,
  .activity,
  .rank-row,
  .detail-stat,
  .birthday-card {
    gap: 8px;
    padding: 12px;
  }

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

  .product-card {
    min-height: auto;
  }

  .warehouse-actions .search,
  .warehouse-search {
    width: 100%;
  }

  input,
  select,
  textarea,
  .modal input,
  .modal select,
  .modal textarea,
  .login-card input {
    min-height: 46px;
    font-size: 16px;
  }

  textarea {
    min-height: 92px;
  }

  .toast {
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 10px;
    width: auto;
    text-align: center;
  }

  .birthday-card {
    display: grid;
  }

  .login-shell {
    width: 100%;
    max-height: calc(100vh - 28px);
    overflow: auto;
  }

  .login-hero {
    display: none;
  }
}

@media print {
  @page {
    size: A4;
    margin: 10mm;
  }

  body {
    background: white;
    color: black;
  }

  .app,
  .login-screen,
  .toast,
  .modal {
    display: none !important;
  }

  .print-area {
    display: block;
  }

  .invoice-a4 {
    width: 190mm;
    min-height: 277mm;
    margin: 0 auto;
    border: 0;
    border-radius: 0;
    padding: 10mm;
    box-shadow: none;
    page-break-after: always;
  }

  .invoice-a4-head {
    grid-template-columns: minmax(0, 1fr) 26mm;
    gap: 2mm;
    align-items: start;
  }

  .invoice-company {
    grid-template-columns: 12mm minmax(0, 1fr);
    gap: 2mm;
    padding: 2mm;
  }

  .invoice-logo {
    width: 12mm;
    height: 12mm;
  }

  .invoice-company-name {
    margin-bottom: 1.2mm;
    font-size: 10.5px !important;
    line-height: 1.18;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .invoice-company-lines {
    font-size: 9.2px;
    line-height: 1.18;
  }

  .invoice-company-lines p {
    overflow-wrap: anywhere;
  }

  .invoice-company-lines span {
    display: inline;
    margin-left: 3mm;
  }

  .invoice-meta {
    padding: 1.5mm;
    font-size: 9.5px;
  }

  .invoice-meta strong {
    font-size: 10.5px;
  }

  .invoice-qr {
    width: 20mm;
  }

  .invoice-qr .qr-code {
    width: 18mm;
    height: 18mm;
    padding: 0.8mm;
  }

  .invoice-a4 .watermark-logo {
    position: absolute;
    opacity: 0.055;
  }

  .invoice-a4 h1,
  .invoice-a4 h2,
  .invoice-a4 h3,
  .invoice-a4 p,
  .invoice-a4 span,
  .invoice-a4 strong,
  .invoice-a4 td,
  .invoice-a4 th {
    color: black;
  }

  .invoice-a4 .invoice-items th,
  .invoice-a4 .invoice-items td {
    border: 0;
    border-bottom: 1px solid #777;
  }

  .print-sheet,
  .print-a4 {
    position: relative;
    width: 190mm;
    min-height: 277mm;
    margin: 0 auto;
    overflow: hidden;
    padding: 10mm;
    font-family: Arial, sans-serif;
    box-shadow: none;
    page-break-after: always;
  }

  .print-sheet h1 {
    margin-bottom: 16px;
    font-size: 24px;
  }

  .print-sheet table {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
  }

  .print-sheet th,
  .print-sheet td {
    border: 1px solid #222;
    padding: 8px;
    color: black;
  }

  .print-sheet .company-header {
    border-bottom-color: #222;
  }

  .print-sheet .company-header h2,
  .print-sheet .company-header p {
    color: black;
  }

  .print-sheet .watermark-logo {
    position: fixed;
    opacity: 0.06;
  }

  .print-qr .qr-code {
    width: 140px;
    height: 140px;
  }
}
