:root {
  --bg: #eef2ee;
  --surface: #ffffff;
  --surface-soft: #f7f9f7;
  --ink: #142219;
  --muted: #66736a;
  --line: #dfe6e0;
  --green-950: #08150f;
  --green-900: #10271c;
  --green-800: #173525;
  --green-700: #245039;
  --gold: #d6a24b;
  --gold-soft: #f6ead3;
  --red: #b23a32;
  --red-soft: #fff0ee;
  --orange: #a96517;
  --orange-soft: #fff6e7;
  --success: #267349;
  --success-soft: #e9f6ee;
  --shadow: 0 16px 45px rgba(15, 42, 28, .08);
  --radius: 18px;
  --sidebar: 248px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; }
button, select, input[type="file"] { cursor: pointer; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(2rem, 4vw, 3.1rem); line-height: 1; letter-spacing: -.04em; }
h2 { margin-bottom: 4px; font-size: 1.25rem; letter-spacing: -.02em; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.app-shell { min-height: 100vh; }
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 15%, rgba(214,162,75,.18), transparent 32%),
    linear-gradient(145deg, var(--green-950), var(--green-800));
}
.auth-card {
  width: min(460px, 100%);
  padding: clamp(26px, 6vw, 44px);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 28px 80px rgba(0,0,0,.28);
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 34px; }
.auth-brand strong, .auth-brand small { display: block; }
.auth-brand strong { letter-spacing: .05em; }
.auth-brand small { color: var(--muted); }
.auth-state h1 { margin-bottom: 12px; font-size: clamp(1.8rem, 7vw, 2.5rem); }
.auth-state > p:not(.eyebrow):not(.auth-hint) { color: var(--muted); }
.auth-form { display: grid; gap: 14px; margin-top: 26px; }
.auth-actions { margin-top: 24px; }
.auth-hint { margin: 14px 0 0; color: var(--muted); font-size: .8rem; text-align: center; }
.auth-error { margin: 0; padding: 10px 12px; border-radius: 9px; background: var(--red-soft); color: var(--red); font-size: .82rem; font-weight: 700; }
.loading-wheel { width: 38px; height: 38px; display: block; margin-bottom: 22px; border: 4px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  padding: 26px 18px 20px;
  color: #f6f1e8;
  background: linear-gradient(180deg, var(--green-950), var(--green-900));
}
.brand { display: flex; align-items: center; gap: 12px; padding: 2px 6px 24px; }
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 12px;
  background: linear-gradient(135deg, #f1d59e, var(--gold));
  color: var(--green-950);
  font-weight: 900;
  letter-spacing: -.05em;
}
.brand strong { display: block; font-size: 1.02rem; letter-spacing: .04em; }
.brand small { display: block; margin-top: 1px; color: #96aa9d; font-size: .76rem; }
.main-nav { display: grid; gap: 6px; margin-top: 22px; }
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #aebdb3;
  text-align: left;
  font-weight: 650;
}
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,.08); color: #fff; }
.nav-item span { width: 20px; color: var(--gold); font-size: 1.2rem; text-align: center; }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 9px; padding: 14px 8px 0; color: #8ca093; font-size: .76rem; }
.save-dot { width: 8px; height: 8px; border-radius: 50%; background: #6ed28e; box-shadow: 0 0 0 4px rgba(110,210,142,.1); }
.save-dot.syncing { background: var(--gold); animation: pulse-dot 1s ease-in-out infinite; }
.save-dot.offline { background: #d77a6d; }
@keyframes pulse-dot { 50% { opacity: .4; } }

.main { min-height: 100vh; margin-left: var(--sidebar); padding: 44px clamp(24px, 4vw, 64px) 70px; }
.mobile-header, .mobile-nav { display: none; }
.view { display: none; max-width: 1440px; margin: 0 auto; }
.view.active { display: block; animation: view-in .18s ease-out; }
@keyframes view-in { from { opacity: .6; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.compact-head { align-items: center; }
.eyebrow { margin-bottom: 8px; color: var(--green-700); font-size: .73rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.lead { margin-bottom: 0; color: var(--muted); font-size: 1rem; }

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-weight: 750;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--green-900); color: white; box-shadow: 0 8px 20px rgba(16,39,28,.16); }
.button-primary:hover { background: var(--green-800); }
.button-secondary { border-color: var(--line); background: var(--surface); color: var(--ink); }
.button-secondary:hover { background: var(--surface-soft); }
.button-large { min-height: 50px; padding-inline: 22px; }
.button-block { width: 100%; }
.text-button { padding: 4px; border: 0; background: transparent; color: var(--green-700); font-weight: 750; }
.back-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 1.35rem; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  min-height: 154px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 23px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 7px 24px rgba(20,34,25,.04);
  text-align: left;
}
.stat-card:hover { border-color: #b9cabd; box-shadow: var(--shadow); }
.stat-card.warn { background: linear-gradient(145deg, var(--surface), var(--orange-soft)); }
.stat-label { color: var(--muted); font-weight: 700; }
.stat-value { margin: 8px 0 2px; font-size: 2.75rem; line-height: 1; letter-spacing: -.05em; }
.stat-note { margin-top: auto; color: var(--muted); font-size: .8rem; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, .8fr); gap: 20px; }
.panel, .form-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 7px 24px rgba(20,34,25,.035);
}
.panel { padding: 24px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.section-head .eyebrow { margin-bottom: 4px; }
.order-stack { display: grid; gap: 8px; }
.order-row {
  width: 100%;
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 13px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--surface-soft);
  text-align: left;
}
.order-row:hover { border-color: var(--line); background: #fff; }
.date-tile { padding-right: 13px; border-right: 1px solid var(--line); text-align: center; }
.date-tile strong { display: block; font-size: 1.04rem; }
.date-tile span { color: var(--muted); font-size: .72rem; }
.order-row-main { min-width: 0; }
.order-row-main strong, .order-row-main span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-row-main span { color: var(--muted); font-size: .8rem; }
.amount { font-weight: 800; white-space: nowrap; }
.attention-list { display: grid; gap: 10px; }
.attention-item { display: flex; gap: 11px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.attention-item:last-child { border-bottom: 0; }
.attention-symbol { width: 28px; height: 28px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: var(--orange-soft); color: var(--orange); font-weight: 900; }
.attention-item strong { display: block; font-size: .88rem; }
.attention-item span { color: var(--muted); font-size: .78rem; }

.toolbar { display: flex; gap: 10px; margin-bottom: 16px; }
.toolbar select, .search-field { min-height: 46px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.toolbar select { padding: 0 38px 0 13px; }
.search-field { min-width: min(480px, 65%); display: flex; align-items: center; gap: 9px; padding: 0 14px; }
.search-field span { color: var(--muted); font-size: 1.2rem; }
.search-field input { width: 100%; border: 0; outline: 0; background: transparent; cursor: text; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.orders-table, .catalog-table { width: 100%; border-collapse: collapse; }
.orders-table th, .catalog-table th { padding: 13px 16px; border-bottom: 1px solid var(--line); color: var(--muted); background: var(--surface-soft); font-size: .74rem; letter-spacing: .04em; text-align: left; text-transform: uppercase; }
.orders-table td, .catalog-table td { padding: 15px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.orders-table tr:last-child td, .catalog-table tr:last-child td { border-bottom: 0; }
.orders-table tbody tr { cursor: pointer; }
.orders-table tbody tr:hover { background: var(--surface-soft); }
.orders-table td strong, .orders-table td small { display: block; }
.orders-table td small { margin-top: 2px; color: var(--muted); }
.align-right { text-align: right !important; }
.row-open { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 99px; background: #edf2ee; color: var(--green-700); font-size: .74rem; font-weight: 800; white-space: nowrap; }
.status-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-badge.waiting, .status-badge.unpaid { background: var(--orange-soft); color: var(--orange); }
.status-badge.paid { background: var(--success-soft); color: var(--success); }
.status-badge.ready { background: #eaf1fb; color: #345f93; }
.empty-state { padding: 30px 16px; color: var(--muted); text-align: center; }
.empty-state strong { display: block; margin-bottom: 4px; color: var(--ink); font-size: 1rem; }

.editor-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 15px; margin-bottom: 24px; }
.editor-head h1 { margin: 0; font-size: 2rem; }
.editor-head .eyebrow { margin-bottom: 3px; }
.editor-actions { display: flex; gap: 9px; }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; gap: 20px; }
.editor-main { display: grid; gap: 16px; }
.form-section { padding: clamp(20px, 3vw, 28px); }
.form-section-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 22px; }
.form-section-title > div:first-of-type { flex: 1; }
.form-section-title h2 { margin-bottom: 3px; }
.form-section-title p { margin-bottom: 0; color: var(--muted); font-size: .85rem; }
.step-number { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 9px; background: var(--gold-soft); color: #795317; font-size: .8rem; font-weight: 900; }
.form-grid { display: grid; gap: 15px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-two { grid-column: span 2; }
.field { display: grid; gap: 6px; color: var(--ink); font-size: .81rem; font-weight: 750; }
.field input, .field select, .field textarea, .toolbar select {
  width: 100%;
  border: 1px solid #ccd7ce;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  outline: 0;
}
.field input, .field select { min-height: 43px; padding: 9px 11px; }
.field textarea { resize: vertical; padding: 11px; cursor: text; }
.field input:focus, .field select:focus, .field textarea:focus, .toolbar select:focus { border-color: var(--green-700); box-shadow: 0 0 0 3px rgba(36,80,57,.1); }
.field input::placeholder, .field textarea::placeholder { color: #9ba59e; }
.top-gap { margin-top: 15px; }
.money-input, .number-suffix { display: flex; align-items: center; border: 1px solid #ccd7ce; border-radius: 10px; background: #fff; overflow: hidden; }
.money-input input, .number-suffix input { border: 0; border-radius: 0; box-shadow: none !important; }
.money-input span, .number-suffix span { padding: 0 12px; color: var(--muted); font-weight: 800; }
.quick-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.quick-link { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); color: var(--green-700); font-size: .78rem; font-weight: 750; }

.upload-zone { min-height: 145px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 20px; border: 2px dashed #b8c6bb; border-radius: 14px; background: var(--surface-soft); text-align: center; transition: background .12s, border .12s; }
.upload-zone:hover, .upload-zone.dragging { border-color: var(--gold); background: #fffaf0; }
.upload-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-zone strong { margin-top: 4px; }
.upload-zone small { color: var(--muted); }
.upload-icon { font-size: 1.8rem; color: var(--green-700); }
.attachment-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-top: 14px; }
.attachment-card { min-width: 0; display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 9px; border: 1px solid var(--line); border-radius: 11px; }
.attachment-preview { width: 54px; height: 54px; display: grid; place-items: center; overflow: hidden; border-radius: 8px; background: var(--surface-soft); color: var(--muted); font-size: .7rem; font-weight: 800; }
.attachment-preview img { width: 100%; height: 100%; object-fit: cover; }
.attachment-info { min-width: 0; }
.attachment-info strong { display: block; overflow: hidden; font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.attachment-info select { width: 100%; margin-top: 5px; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: .72rem; }
.icon-button { width: 29px; height: 29px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); }
.icon-button:hover { background: var(--red-soft); color: var(--red); }

.position-quick-add { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 15px; }
.grow { flex: 1; }
.positions-list { display: grid; gap: 9px; }
.position-row { display: grid; grid-template-columns: 112px minmax(150px, 1fr) 74px 112px 112px 34px; gap: 8px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.position-row .field { font-size: .72rem; }
.position-row .field input, .position-row .field select { min-height: 39px; padding: 7px 8px; }
.position-row .remove-position { margin-bottom: 4px; }
.positions-empty { padding: 22px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); text-align: center; }
.time-row { display: flex; align-items: flex-end; gap: 10px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.time-row .field { max-width: 210px; }
.timer-display { padding-bottom: 10px; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 800; }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.check { display: flex; align-items: flex-start; gap: 9px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); font-size: .82rem; font-weight: 650; }
.check input { width: 18px; height: 18px; accent-color: var(--green-700); }

.calculation-panel { min-width: 0; }
.sticky-calc { position: sticky; top: 24px; padding: 24px; border-radius: var(--radius); background: var(--green-900); color: #f8f5ec; box-shadow: 0 18px 50px rgba(10,30,19,.18); }
.sticky-calc .eyebrow { color: var(--gold); }
.price-total { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding-bottom: 18px; border-bottom: 1px solid rgba(255,255,255,.12); }
.price-total span { color: #9db0a3; font-size: .82rem; }
.price-total strong { font-size: 1.8rem; letter-spacing: -.04em; white-space: nowrap; }
.price-details { margin: 15px 0; }
.price-details div { display: flex; justify-content: space-between; gap: 14px; padding: 4px 0; }
.price-details dt { color: #9db0a3; font-size: .78rem; }
.price-details dd { margin: 0; font-size: .82rem; font-weight: 800; }
.recommended-price { display: flex; justify-content: space-between; gap: 12px; padding: 12px; border-radius: 10px; background: rgba(214,162,75,.13); }
.recommended-price span { color: #e8d4ac; font-size: .75rem; }
.recommended-price strong { color: #f1d59e; white-space: nowrap; }
.warning-list { display: grid; gap: 7px; margin-top: 15px; }
.warning-item { display: flex; gap: 8px; padding: 9px; border-radius: 9px; background: rgba(255,255,255,.07); color: #e8ece9; font-size: .76rem; }
.warning-item.error { background: rgba(255,111,98,.12); color: #ffd8d3; }
.warning-item.ok { background: rgba(110,210,142,.12); color: #c9f2d5; }
.calc-actions { display: grid; gap: 8px; margin-top: 18px; }
.sticky-calc .button-primary { background: linear-gradient(135deg, #f1d59e, var(--gold)); color: var(--green-950); }
.sticky-calc .button-secondary { border-color: rgba(255,255,255,.17); background: rgba(255,255,255,.06); color: white; }

.customer-tools { display: flex; align-items: flex-end; gap: 9px; margin-bottom: 16px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.segment-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.segment-field legend { margin-bottom: 6px; color: var(--ink); font-size: .81rem; font-weight: 750; }
.segmented-control { width: min(360px, 100%); display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); }
.segmented-control label { cursor: pointer; }
.segmented-control input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-control span { min-height: 36px; display: grid; place-items: center; padding: 7px 12px; border-radius: 8px; color: var(--muted); font-size: .8rem; font-weight: 800; }
.segmented-control input:checked + span { background: var(--surface); color: var(--green-800); box-shadow: 0 2px 8px rgba(16,39,28,.1); }
.optional-details { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.optional-details summary { padding: 12px 14px; cursor: pointer; color: var(--green-700); font-size: .82rem; font-weight: 800; }
.optional-details-body { display: grid; gap: 14px; padding: 0 14px 14px; }
.compact-check { padding: 9px 10px; background: var(--surface); }
.button:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.invoice-card { display: grid; gap: 2px; margin-top: 15px; padding: 12px; border: 1px solid rgba(255,255,255,.12); border-radius: 10px; background: rgba(255,255,255,.06); }
.invoice-card-label { color: #9db0a3; font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.invoice-card strong { font-size: .92rem; }
.invoice-card small { color: #b9c7bd; font-size: .72rem; }
.invoice-card.open, .invoice-card.overdue { border-color: rgba(214,162,75,.38); background: rgba(214,162,75,.12); }
.invoice-card.paid { border-color: rgba(110,210,142,.3); background: rgba(110,210,142,.12); }
.invoice-card.cancelled { opacity: .72; }
.invoice-more { text-align: center; }
.invoice-more summary { padding: 7px; cursor: pointer; color: #b9c7bd; font-size: .73rem; font-weight: 700; }
.invoice-history { display: grid; gap: 5px; margin: 2px 0 6px; }
.invoice-history button { width: 100%; padding: 7px 9px; border: 1px solid rgba(255,255,255,.12); border-radius: 8px; background: rgba(255,255,255,.05); color: #dbe3dd; font-size: .72rem; text-align: left; }
.text-danger { padding: 7px; border: 0; background: transparent; color: #ffd1cc; font-size: .75rem; font-weight: 750; }
.settings-details { margin: 16px 0; padding: 0; overflow: hidden; }
.settings-details > summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 21px 26px; cursor: pointer; list-style: none; }
.settings-details > summary::-webkit-details-marker { display: none; }
.settings-details > summary strong, .settings-details > summary small { display: block; }
.settings-details > summary small { margin-top: 3px; color: var(--muted); font-size: .82rem; font-weight: 400; }
.summary-action { color: var(--green-700); font-size: .8rem; font-weight: 800; }
.settings-details[open] .summary-action { font-size: 0; }
.settings-details[open] .summary-action::after { content: "Schließen"; font-size: .8rem; }
.settings-details-body { padding: 4px 26px 26px; border-top: 1px solid var(--line); }
.settings-details-body .form-section-title { margin-top: 20px; }
.settings-warning { margin: 14px 0 0; padding: 10px 12px; border-radius: 9px; background: var(--orange-soft); color: #7b4a10; font-size: .8rem; font-weight: 700; }
.app-dialog { width: min(560px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 18px; color: var(--ink); background: var(--surface); box-shadow: 0 28px 90px rgba(5,20,11,.32); }
.app-dialog::backdrop { background: rgba(8,21,15,.62); backdrop-filter: blur(3px); }
.app-dialog form { padding: 25px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dialog-head h2 { margin: 0; font-size: 1.55rem; }
.dialog-close { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); font-size: 1.3rem; }
.dialog-copy { margin: 10px 0 20px; color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }

.settings-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 16px; margin-bottom: 16px; }
.backup-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.file-button { position: relative; overflow: hidden; cursor: pointer; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.hint { margin: 14px 0 0; color: var(--muted); font-size: .8rem; }
.catalog-section { margin-top: 16px; }
.cloud-section { margin: 16px 0; }
.cloud-badge { display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 99px; background: var(--surface-soft); color: var(--muted); font-size: .75rem; font-weight: 800; }
.cloud-badge.online { background: var(--success-soft); color: var(--success); }
.cloud-info { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.cloud-info strong, .cloud-info span { display: block; }
.cloud-info span { margin-top: 3px; color: var(--muted); font-size: .82rem; }
.catalog-section .table-wrap { box-shadow: none; }
.catalog-table input, .catalog-table select { width: 100%; min-height: 36px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.catalog-table .price-cell { width: 130px; }
.catalog-table .category-cell { width: 150px; }

.customer-toolbar .search-field { min-width: min(620px, 100%); }
.customer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.customer-card { min-width: 0; padding: 19px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 7px 24px rgba(20,34,25,.035); text-align: left; }
.customer-card:hover { border-color: #b9cabd; box-shadow: var(--shadow); transform: translateY(-1px); }
.customer-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.customer-card-head strong { display: block; overflow: hidden; font-size: 1.04rem; text-overflow: ellipsis; white-space: nowrap; }
.customer-card-head small { display: block; margin-top: 2px; color: var(--muted); }
.customer-kind { flex: 0 0 auto; padding: 4px 8px; border-radius: 99px; background: var(--gold-soft); color: #795317; font-size: .68rem; font-weight: 850; text-transform: uppercase; }
.customer-card-meta { display: grid; gap: 5px; margin-top: 15px; color: var(--muted); font-size: .8rem; }
.customer-card-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--line); color: var(--green-700); font-size: .76rem; font-weight: 800; }
.customer-detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; gap: 20px; }
.customer-side { min-width: 0; display: grid; gap: 16px; }
.customer-summary { background: linear-gradient(145deg, var(--green-900), var(--green-800)); color: #fff; }
.customer-summary .eyebrow { color: var(--gold); }
.customer-stat { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.12); }
.customer-stat strong { color: #f1d59e; font-size: 1.6rem; }
.customer-stat span { color: #c3d0c7; font-size: .78rem; }
.customer-summary .button { margin-top: 18px; background: linear-gradient(135deg, #f1d59e, var(--gold)); color: var(--green-950); }
.asset-list { display: grid; gap: 10px; }
.asset-empty { padding: 24px 16px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); text-align: center; }
.asset-empty strong, .asset-empty span { display: block; }
.asset-empty strong { margin-bottom: 3px; color: var(--ink); }
.asset-card { width: 100%; display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); text-align: left; }
.asset-card:hover { border-color: #b9cabd; background: #fff; }
.asset-kind-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 12px; background: var(--gold-soft); color: #795317; font-size: 1.25rem; font-weight: 900; }
.asset-card-main { min-width: 0; }
.asset-card-main strong, .asset-card-main span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-card-main span { margin-top: 2px; color: var(--muted); font-size: .78rem; }
.asset-card-count { color: var(--muted); font-size: .72rem; white-space: nowrap; }
.customer-order-list { display: grid; gap: 8px; }
.customer-order-link { width: 100%; display: grid; gap: 2px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); text-align: left; }
.customer-order-link strong { font-size: .8rem; }
.customer-order-link span { color: var(--muted); font-size: .72rem; }
.customer-order-empty { color: var(--muted); font-size: .8rem; }
.asset-dialog { width: min(760px, calc(100% - 28px)); }
.asset-dialog[open] { max-height: calc(100vh - 28px); overflow-y: auto; }
.compact-upload { min-height: 112px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; max-width: 360px; padding: 12px 16px; border-radius: 11px; background: var(--green-950); color: #fff; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--red); }

@media (max-width: 1180px) {
  .customer-detail-layout { grid-template-columns: 1fr; }
  .editor-layout { grid-template-columns: 1fr; }
  .sticky-calc { position: static; }
  .position-row { grid-template-columns: 110px minmax(180px, 1fr) 70px 100px 100px 34px; overflow-x: auto; }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  body { padding-bottom: 66px; }
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 0 16px 30px; }
  .mobile-header { height: 70px; display: flex; align-items: center; justify-content: space-between; margin: 0 -16px 24px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
  .mobile-header .brand { padding: 0; color: var(--ink); }
  .brand.compact { gap: 8px; }
  .brand.compact .brand-mark { width: 35px; height: 35px; border-radius: 10px; font-size: .82rem; }
  .mobile-nav { position: fixed; inset: auto 0 0; z-index: 50; height: 66px; display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); background: rgba(255,255,255,.97); box-shadow: 0 -10px 30px rgba(16,39,28,.08); }
  .mobile-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; border: 0; background: transparent; color: var(--muted); font-size: .68rem; font-weight: 750; }
  .mobile-nav button span { font-size: 1.2rem; line-height: 1.2; }
  .mobile-nav button.active { color: var(--green-700); }
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-card { min-height: 128px; padding: 16px; }
  .stat-value { font-size: 2rem; }
  .editor-head { grid-template-columns: auto 1fr; }
  .editor-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  h1 { font-size: 2rem; }
  .page-head { align-items: flex-start; }
  .page-head > .button { display: none; }
  #view-customers .page-head { flex-direction: column; }
  #view-customers .page-head > .button { width: 100%; display: inline-flex; }
  .stat-grid { grid-template-columns: 1fr; gap: 9px; }
  .stat-card { min-height: 104px; display: grid; grid-template-columns: 1fr auto; align-items: center; }
  .stat-label { align-self: end; }
  .stat-value { grid-row: span 2; margin: 0; }
  .stat-note { align-self: start; margin: 0; }
  .panel { padding: 18px; }
  .order-row { grid-template-columns: 58px minmax(0, 1fr); }
  .order-row .amount { display: none; }
  .toolbar { flex-direction: column; }
  .search-field { min-width: 100%; }
  .toolbar select { width: 100%; }
  .form-grid.two, .check-grid { grid-template-columns: 1fr; }
  .span-two { grid-column: auto; }
  .form-section { padding: 18px; }
  .position-quick-add { align-items: stretch; flex-direction: column; }
  .position-row { grid-template-columns: 1fr 1fr; }
  .position-row .description-field { grid-column: 1 / -1; grid-row: 1; }
  .position-row .remove-position { align-self: center; justify-self: end; }
  .time-row { align-items: stretch; flex-direction: column; }
  .time-row .field { max-width: none; }
  .timer-display { padding: 0; text-align: center; }
  .attachment-grid { grid-template-columns: 1fr; }
  .editor-head h1 { font-size: 1.45rem; }
  .editor-actions .button { flex: 1; }
  .toast { right: 12px; bottom: 78px; left: 12px; max-width: none; }
  .catalog-section .form-section-title { flex-direction: column; }
  .customer-tools { align-items: stretch; flex-direction: column; }
  .segmented-control { width: 100%; }
  .customer-grid { grid-template-columns: 1fr; }
  .split-title { flex-wrap: wrap; }
  .split-title .button { width: 100%; }
  .asset-card { grid-template-columns: 42px minmax(0, 1fr); }
  .asset-kind-icon { width: 42px; height: 42px; }
  .asset-card-count { grid-column: 2; }
  .settings-details > summary { padding: 18px; }
  .settings-details-body { padding: 2px 18px 18px; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .button { width: 100%; }
}

body.print-preview-open { overflow: hidden; }
.print-preview { position: fixed; inset: 0; z-index: 1000; overflow: auto; background: #e6ebe7; color: #172017; }
.print-toolbar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px max(16px, calc((100vw - 210mm) / 2)); border-bottom: 1px solid #ccd6ce; background: rgba(255,255,255,.97); box-shadow: 0 8px 24px rgba(16,39,28,.1); }
.print-toolbar-title { display: flex; min-width: 0; flex-direction: column; text-align: center; }
.print-toolbar-title span { color: #66736a; font-size: .8rem; }
.print-document { box-sizing: border-box; width: min(210mm, calc(100% - 32px)); min-height: 297mm; margin: 24px auto 40px; padding: 16mm; background: #fff; box-shadow: 0 14px 45px rgba(16,39,28,.16); font: 14px/1.45 Arial, sans-serif; }
.print-header { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 16px; border-bottom: 3px solid #173525; }
.print-brand { color: #173525; font-size: 1.15rem; font-weight: 900; letter-spacing: .08em; }
.print-meta { display: flex; flex-direction: column; color: #5d6b61; text-align: right; }
.print-title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 28px 0 18px; }
.print-title-row p { margin: 0; color: #69756d; font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.print-title-row h1 { margin: 2px 0 0; font-size: 1.75rem; }
.print-status { display: flex; flex-direction: column; text-align: right; }
.print-status span { color: #69756d; font-size: .72rem; text-transform: uppercase; }
.print-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.print-document section { margin: 18px 0; }
.print-document section h2 { margin: 0 0 8px; padding-bottom: 5px; border-bottom: 1px solid #dfe6e0; color: #69756d; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
.print-document section p { margin: 5px 0 0; }
.print-table-wrap { width: 100%; overflow-x: auto; }
.print-table { width: 100%; border-collapse: collapse; margin-top: 18px; }
.print-table th, .print-table td { padding: 9px 7px; border-bottom: 1px solid #dfe6e0; text-align: left; vertical-align: top; }
.print-table th { color: #5d6b61; font-size: .75rem; }
.print-table th:first-child, .print-table td:first-child { width: 52%; }
.print-table .print-right { text-align: right; white-space: nowrap; }
.print-total { display: flex; align-items: baseline; justify-content: flex-end; gap: 20px; margin-top: 18px; padding: 14px 0; border-top: 2px solid #173525; }
.print-total span { font-weight: 800; }
.print-total strong { font-size: 1.4rem; }
.print-payment { display: flex; justify-content: flex-end; color: #4f5f54; font-size: .85rem; }
.print-footer { margin-top: 42px; padding-top: 12px; border-top: 1px solid #dfe6e0; color: #66736a; font-size: .75rem; }
.print-footer p { margin: 4px 0; }

@media (max-width: 640px) {
  .print-toolbar { align-items: stretch; gap: 8px; padding: 10px; }
  .print-toolbar-title { display: none; }
  .print-toolbar .button { flex: 1; padding-inline: 10px; }
  .print-document { width: calc(100% - 16px); min-height: 0; margin: 8px auto 24px; padding: 22px 14px; }
  .print-header, .print-title-row { align-items: flex-start; }
  .print-grid { grid-template-columns: 1fr; gap: 0; }
  .print-table { min-width: 0; table-layout: fixed; font-size: .7rem; }
  .print-table th, .print-table td { padding: 7px 3px; }
  .print-table th:first-child, .print-table td:first-child { width: 46%; }
  .print-table th:nth-child(2), .print-table td:nth-child(2) { width: 10%; }
  .print-table th:nth-child(3), .print-table td:nth-child(3),
  .print-table th:nth-child(4), .print-table td:nth-child(4) { width: 22%; }
}
@media print {
  @page { size: A4 portrait; margin: 12mm; }
  body.print-preview-open { overflow: visible !important; background: #fff !important; }
  body.print-preview-open > :not(#print-preview) { display: none !important; }
  #print-preview { position: static !important; display: block !important; overflow: visible !important; background: #fff !important; }
  .print-toolbar { display: none !important; }
  .print-document { width: auto !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; box-shadow: none !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .print-grid { grid-template-columns: 1fr 1fr !important; }
  .print-table-wrap { overflow: visible !important; }
  .print-table { min-width: 0 !important; }
  .print-table thead { display: table-header-group; }
  .print-table tr, .print-document section, .print-total { break-inside: avoid; }
  .sidebar, .mobile-header, .mobile-nav, .editor-head, .calc-actions, .button, .back-button { display: none !important; }
  .main { margin: 0; padding: 0; }
  .view { display: none !important; }
  #view-editor { display: block !important; }
  .editor-layout { grid-template-columns: 1fr; }
  .form-section, .sticky-calc { box-shadow: none; break-inside: avoid; }
}
