:root {
  color-scheme: light;
  --color-ink: #211d1e;
  --color-muted: #716b6d;
  --color-page: #f5f3f4;
  --color-card: #fff;
  --color-line: #e5dfe1;
  --color-primary: #d91435;
  --color-primary-hover: #b70f2d;
  --color-primary-dark: #a90f29;
  --color-primary-soft: #f9dce2;
  --color-sidebar: #211d1e;
  --color-input: #fafbf9;
  --color-success: #397951;
  --color-success-bg: #e2f1e6;
  --color-warning: #8a651d;
  --color-warning-bg: #fff0d0;
  --color-error: #843e38;
  --color-error-bg: #f5e4e2;
  --shadow-button: 0 8px 20px rgba(217,20,53,.2);
  --shadow-dialog: 0 30px 90px rgba(0,0,0,.25);
  font-family: "DM Sans", Arial, sans-serif;
  color: var(--color-ink);
  background: var(--color-page);
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; color: var(--color-ink); background: var(--color-page); font: 15px/1.5 "DM Sans", Arial, sans-serif; }
a { color: var(--color-primary-dark); text-underline-offset: 3px; }
h1,h2,h3,strong,.brand { font-family: "Manrope", Arial, sans-serif; }
h1 { margin: 8px 0 12px; font-size: clamp(30px,4vw,48px); line-height: 1.08; letter-spacing: -.045em; }
h2 { margin: 5px 0 12px; font-size: 24px; line-height: 1.2; letter-spacing: -.03em; }
p { margin: 0 0 12px; }
.eyebrow { color: var(--color-primary-dark); font-size: 10px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; }
.eyebrow.light { color: #f9dce2; }
.muted { color: var(--color-muted); font-size: 13px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0,1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 30px 22px; display: flex; flex-direction: column; color: #fff; background: var(--color-sidebar); border-right: 4px solid var(--color-primary); }
.sidebar-brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.sidebar-brand strong { display: block; font-size: 15px; line-height: 1.2; }
.sidebar-brand small { display: block; margin-top: 2px; color: #9b9295; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.brand-mark { width: 39px; height: 39px; flex: 0 0 39px; display: grid; place-items: center; border-radius: 12px; color: #fff; background: var(--color-primary); font: 800 12px "Manrope",sans-serif; letter-spacing: -.02em; }
.sidebar nav { display: grid; gap: 7px; margin: 55px 0; }
.sidebar nav a { padding: 12px 14px; border-radius: 10px; color: #bdb2b5; text-decoration: none; font-weight: 600; transition: color 180ms ease,background-color 180ms ease; }
.sidebar nav a:hover,.sidebar nav a.active { color: #fff; background: var(--color-primary); }
.sidebar-user { margin-top: auto; padding-top: 18px; display: grid; grid-template-columns: 38px minmax(0,1fr) 40px; align-items: center; gap: 10px; border-top: 1px solid #3d3739; }
.sidebar-user strong { display: block; overflow: hidden; color: #fff; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user small { color: #9b9295; font-size: 11px; }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: var(--color-primary); background: #fff; font: 800 14px "Manrope",sans-serif; }
.logout-button { width: 40px; height: 40px; padding: 0; border: 1px solid #4b4446; border-radius: 10px; color: #fff; background: transparent; box-shadow: none; font-size: 18px; }
.logout-button:hover { border-color: var(--color-primary); background: var(--color-primary); }
.mobile-header { display: none; }
.app-main { min-width: 0; max-width: 1440px; width: 100%; padding: 45px clamp(24px,5vw,72px) 64px; }
.app-main.narrow { max-width: 900px; }

.page-heading,.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 30px; margin-bottom: 34px; }
.page-heading h1,.page-head h1 { margin-bottom: 8px; }
.page-heading p,.page-head p { max-width: 630px; color: var(--color-muted); font-size: 16px; }
.panel,.card { padding: 23px; background: var(--color-card); border: 1px solid var(--color-line); border-radius: 18px; box-shadow: 0 2px 2px rgba(20,30,26,.01); margin-bottom: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 18px; }
.page-heading h1:first-child::before { content: "Übersicht"; display: block; margin-bottom: 10px; color: var(--color-primary-dark); font: 700 10px "DM Sans",sans-serif; letter-spacing: .15em; text-transform: uppercase; }
.table-panel { padding: 8px 15px 12px; overflow: hidden; }
.detail-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 14px; }
.detail-grid .panel { min-width: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }

button,.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; padding: 11px 18px; border: 0; border-radius: 11px; color: #fff; background: var(--color-primary); box-shadow: var(--shadow-button); font: 600 15px "DM Sans",sans-serif; cursor: pointer; text-decoration: none; transition: background-color 180ms ease,transform 180ms ease; }
button:hover,.button:hover { background: var(--color-primary-hover); }
button:active,.button:active { transform: translateY(1px); }
.secondary,.button.secondary { color: var(--color-primary-dark); background: #fff; border: 1px solid var(--color-line); box-shadow: none; font-weight: 700; }
.secondary:hover,.button.secondary:hover { color: #fff; border-color: var(--color-primary); background: var(--color-primary); }
.button-danger { color: var(--color-error); background: #fff; border: 1px solid #caa8a5; box-shadow: none; }
.button-danger:hover { color: #fff; background: var(--color-error); }
button:disabled { opacity: .62; cursor: wait; }
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,[tabindex]:focus-visible { outline: 3px solid rgba(217,20,53,.34); outline-offset: 3px; }

label { display: block; margin: 12px 0 0; font-size: 12px; font-weight: 600; }
input,select,textarea { width: 100%; margin-top: 6px; padding: 11px 12px; color: var(--color-ink); background: var(--color-input); border: 1px solid #dce1dc; border-radius: 9px; font: inherit; }
input:focus,select:focus,textarea:focus { outline: 2px solid #8daf9c; outline-offset: 1px; border-color: #8daf9c; }
textarea { min-height: 100px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 15px; }
.address-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 0 15px; }
.address-grid .span-all { grid-column: 1/-1; }
.address-grid .span-2 { grid-column: span 2; }
.is-hidden,[hidden] { display: none!important; }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 15px; align-items: end; }
.filters label { margin-top: 0; }
.filter-action { padding-bottom: 0; }
.measurement-row { display: grid; grid-template-columns: 1fr 1fr 110px 1.5fr; gap: 12px; align-items: end; padding: 5px 0 17px; border-bottom: 1px solid var(--color-line); }
.measurement-row:has(.remove-measurement) { grid-template-columns: 1fr 1fr 90px 1.2fr auto; }
.remove-measurement { min-height: 44px; padding: 0 4px; white-space: nowrap; }
.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.checkbox input { width: 18px; height: 18px; margin: 0; accent-color: var(--color-primary); }
.password-wrap { position: relative; display: flex; gap: 8px; }
.copy-field { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 9px; align-items: end; }
.copy-field button { white-space: nowrap; }
.password-wrap input { min-width: 0; }
.password-toggle { position: relative; flex: 0 0 44px; padding: 0; margin-top: 6px; font-size: 0; }
.password-toggle::before { content: ""; width: 18px; height: 11px; border: 2px solid currentColor; border-radius: 70% 30% 70% 30%; transform: rotate(45deg); }
.password-toggle::after { content: ""; position: absolute; width: 21px; height: 2px; border-radius: 2px; background: currentColor; transform: rotate(-38deg); }
.password-toggle.is-visible::after { width: 5px; height: 5px; border-radius: 50%; transform: none; }

.notice { margin-bottom: 18px; padding: 14px 16px; color: var(--color-success); background: var(--color-success-bg); border-left: 3px solid var(--color-success); border-radius: 4px 10px 10px 4px; }
.notice.error { color: var(--color-error); background: var(--color-error-bg); border-color: var(--color-error); }
.decision-panel { margin: 22px 0; padding: 17px; background: #faf0f2; border-left: 3px solid var(--color-primary); border-radius: 4px 12px 12px 4px; }
.decision-panel .eyebrow { display: block; margin-bottom: 6px; }
.decision-panel strong { display: block; margin-bottom: 4px; }
.status-line { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.status { display: inline-block; padding: 6px 10px; border-radius: 20px; color: var(--color-ink); background: #eff2ee; font-size: 10px; font-weight: 700; letter-spacing: .08em; line-height: 1.2; text-transform: uppercase; }
.status.ok { color: var(--color-success); background: var(--color-success-bg); }
.status.pending { color: var(--color-warning); background: var(--color-warning-bg); }
.status.bad { color: var(--color-error); background: var(--color-error-bg); }

.scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; background: transparent; font-size: 13px; }
th,td { padding: 13px 8px; border-bottom: 1px solid var(--color-line); text-align: left; vertical-align: top; }
th { color: var(--color-muted); background: transparent; font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
tbody tr:hover { background: #fcf9fa; }
tfoot th,tfoot td { border-top: 2px solid #cfc5c8; border-bottom: 0; background: #faf8f8; font-weight: 700; }
.orders-table { min-width: 820px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.sort-link { color: inherit; text-decoration: none; white-space: nowrap; }
.sort-link:hover { color: var(--color-primary-dark); }
.cell-note { display: block; margin-top: 3px; color: var(--color-muted); font-size: 11px; line-height: 1.35; }
address { font-style: normal; line-height: 1.65; overflow-wrap: anywhere; }
.wide { grid-column: 1/-1; }
.field-hint { display: block; min-height: 18px; margin-top: 4px; color: var(--color-muted); font-size: 11px; font-weight: 400; }
.heading-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.tracking-box strong { font-size: 20px; letter-spacing: .02em; }
.danger-zone { border-color: #ead1cf; }
.label-result { display: grid; grid-template-columns: minmax(210px,280px) minmax(0,1fr); gap: 22px; align-items: start; }
.label-thumb { min-height: 320px; display: grid; place-items: center; overflow: hidden; color: var(--color-primary-dark); background: #f9f7f7; border: 1px solid var(--color-line); border-radius: 12px; text-decoration: none; }
.label-thumb img { display: block; width: 100%; height: 360px; object-fit: contain; background: #fff; }
.label-thumb span { font: 800 30px "Manrope",sans-serif; }
.label-admin-actions { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(230px,.75fr); gap: 14px; align-items: stretch; margin-top: 22px; }
.cancel-form { margin: 0; padding: 17px; border: 1px solid #ead1cf; border-radius: 12px; background: #fff; }
.label-format-form { margin: 0; padding: 17px; background: #faf0f2; border-left: 3px solid var(--color-primary); border-radius: 4px 12px 12px 4px; }
.label-format-form .actions { margin-top: 12px; }
.cancel-form .actions { margin-top: 12px; }
.archive-documents { min-width: 260px; margin: 0; padding: 0; list-style: none; }
.archive-documents li { padding: 8px 0; border-bottom: 1px solid var(--color-line); }
.archive-documents li:last-child { border-bottom: 0; }
.archive-documents li > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.archive-documents .status { flex: 0 0 auto; }
.archive-table { min-width: 680px; }
.log-list { padding: 8px 18px; }
.log-entry { border-bottom: 1px solid var(--color-line); }
.log-entry:last-child { border-bottom: 0; }
.log-entry summary { display: grid; grid-template-columns: 160px minmax(180px,1fr) minmax(130px,.6fr) auto; gap: 15px; align-items: center; padding: 15px 5px; cursor: pointer; }
.log-detail { padding: 0 5px 18px 24px; }
.log-detail pre { max-height: 420px; overflow: auto; padding: 15px; color: #f8eef0; background: #242022; border-radius: 10px; font: 12px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.empty-state { padding: 25px; text-align: center; color: var(--color-muted); }
.print-label { height: 100vh; overflow: hidden; background: #2c292a; }
.print-toolbar { height: 62px; padding: 10px 18px; display: flex; align-items: center; gap: 18px; color: #fff; background: var(--color-sidebar); }
.print-label iframe { width: 100%; height: calc(100vh - 62px); border: 0; background: #fff; }

.login-body { background: var(--color-page); }
.login-layout { min-height: 100vh; display: grid; grid-template-columns: 1.15fr .85fr; }
.login-brand { min-height: 100vh; padding: clamp(35px,7vw,85px); display: flex; flex-direction: column; color: #fff; background: radial-gradient(circle at 8% 92%,#780c20 0,transparent 42%),linear-gradient(145deg,#df1538,#a90f29 74%); }
.login-logo { display: flex; align-items: center; gap: 12px; color: #fff; font: 700 15px "Manrope",sans-serif; text-decoration: none; }
.login-logo span { width: 39px; height: 39px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.5); border-radius: 12px; font-size: 11px; }
.login-statement { margin: auto 0; max-width: 690px; }
.login-statement h2 { margin: 14px 0 20px; color: #fff; font-size: clamp(42px,6vw,76px); line-height: .98; letter-spacing: -.055em; }
.login-statement p { max-width: 500px; color: rgba(255,255,255,.78); font-size: 18px; }
.login-principles { display: flex; flex-wrap: wrap; gap: 12px 26px; padding-top: 22px; border-top: 1px solid rgba(255,255,255,.25); color: rgba(255,255,255,.82); font-size: 12px; }
.login-main { min-height: 100vh; display: grid; align-items: center; padding: 45px clamp(28px,6vw,80px); }
.login-panel { width: 100%; max-width: 390px; margin: auto; }
.login-panel h1 { font-size: clamp(36px,4vw,50px); }
.login-intro { margin-bottom: 28px; color: var(--color-muted); font-size: 16px; }
.login-actions button { width: 100%; }
.privacy-note { margin-top: 24px; color: var(--color-muted); font-size: 11px; }

@media (max-width: 980px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .mobile-header { display: flex; min-height: 76px; padding: 14px 24px; align-items: center; gap: 18px; color: #fff; background: var(--color-sidebar); border-bottom: 3px solid var(--color-primary); }
  .mobile-header .sidebar-brand { flex: 0 0 auto; }
  .mobile-header nav { margin-left: auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
  .mobile-header nav a { padding: 8px 10px; border-radius: 8px; color: #c7bdc0; font-size: 12px; text-decoration: none; }
  .mobile-header nav a.active { color: #fff; background: var(--color-primary); }
  .mobile-header form { flex: 0 0 auto; }
  .app-main { padding: 34px 24px 54px; }
  .detail-grid { grid-template-columns: 1fr; }
  .login-layout { grid-template-columns: 1fr; }
  .login-brand { min-height: 42vh; padding: 38px; }
  .login-statement { margin: 60px 0 45px; }
  .login-statement h2 { font-size: 52px; }
  .login-main { min-height: auto; padding: 54px 28px 70px; }
}

@media (max-width: 700px) {
  .mobile-header { align-items: flex-start; flex-wrap: wrap; gap: 10px 14px; }
  .mobile-header .sidebar-brand { width: calc(100% - 58px); }
  .mobile-header nav { order: 3; width: 100%; margin-left: 0; justify-content: flex-start; }
  .page-heading,.page-head { display: block; margin-bottom: 26px; }
  .page-heading > .button,.page-head > .button { margin-top: 14px; }
  .filters { grid-template-columns: 1fr; }
  .filter-action button { width: 100%; }
  .detail-grid { display: block; }
  .orders-table { min-width: 0; }
  .orders-table th:nth-child(6),.orders-table td:nth-child(6) { display: none; }
  .log-entry summary { grid-template-columns: 1fr auto; }
  .log-entry summary > :nth-child(3) { grid-column: 1/-1; }
  .label-admin-actions { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .app-main { padding: 28px 14px 46px; }
  .mobile-header { padding-inline: 14px; }
  .mobile-header nav a { padding: 7px 8px; }
  h1 { font-size: 34px; }
  h2 { font-size: 21px; }
  .panel,.card { padding: 17px; border-radius: 15px; }
  .table-panel { padding: 5px 10px 10px; }
  .form-grid,.measurement-row { grid-template-columns: 1fr; }
  .copy-field { grid-template-columns: 1fr; }
  .measurement-row:has(.remove-measurement) { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .label-result { grid-template-columns: 1fr; }
  .actions { flex-direction: column; align-items: stretch; }
  .actions button,.actions .button { width: 100%; }
  .login-brand { min-height: 43vh; padding: 28px 22px; }
  .login-statement { margin: 42px 0 30px; }
  .login-statement h2 { font-size: 42px; }
  .login-statement p { font-size: 15px; }
  .login-principles { display: grid; gap: 5px; }
  .login-main { padding: 42px 22px 60px; }
  .orders-table thead { display: none; }
  .orders-table,.orders-table tbody { display: block; }
  .orders-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 15px 4px; border-bottom: 1px solid var(--color-line); }
  .orders-table td { display: block; min-width: 0; padding: 0; border: 0; overflow-wrap: anywhere; }
  .orders-table td:nth-child(1)::before { content: "Auftrag"; }
  .orders-table td:nth-child(2)::before { content: "Kunde / Empfänger"; }
  .orders-table td:nth-child(3)::before { content: "Maße"; }
  .orders-table td:nth-child(4)::before { content: "Produktion"; }
  .orders-table td:nth-child(5)::before { content: "Versand"; }
  .orders-table td::before { display: block; margin-bottom: 5px; color: var(--color-muted); font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
  .orders-table td[colspan] { grid-column: 1/-1; padding: 24px 8px; text-align: center; }
  .orders-table td[colspan]::before { display: none; }
}

@media (prefers-reduced-motion: reduce) { *,*::before,*::after { scroll-behavior: auto!important; transition-duration: .01ms!important; animation-duration: .01ms!important; } }
@media print { .sidebar,.mobile-header,.actions,.filters,.no-print { display: none!important; } .app-shell { display: block; } body { background:#fff; } .app-main { max-width:none; padding:0; } .panel { border:0; box-shadow:none; padding:0; } thead { display:table-header-group; } tfoot { display:table-row-group; } }
