/* Filament Material Control UI
   Domain-led interface for a compact 3D-print material workflow. */

:root {
  color-scheme: light;
  --bg: #f4f5f8;
  --bg-elevated: #f9f9fb;
  --surface: #ffffff;
  --surface-soft: #f8f8fc;
  --surface-strong: #efeff7;
  --border: #dddfea;
  --border-strong: #c8cbd9;
  --text: #202231;
  --text-strong: #111321;
  --muted: #737789;
  --muted-strong: #575b6c;
  --primary: #6558e8;
  --primary-hover: #5548d8;
  --primary-soft: #eeecff;
  --primary-contrast: #ffffff;
  --cyan: #159dba;
  --cyan-soft: #e5f7fb;
  --green: #0b9f76;
  --green-soft: #e4f7f0;
  --amber: #d88a12;
  --amber-soft: #fff3d9;
  --danger: #d7445a;
  --danger-hover: #c2364d;
  --danger-soft: #fdecef;
  --sidebar: #ffffff;
  --sidebar-2: #fbfbfd;
  --sidebar-text: #202231;
  --sidebar-muted: #737789;
  --sidebar-border: #dddfea;
  --sidebar-control: rgba(101,88,232,.06);
  --sidebar-control-hover: rgba(101,88,232,.11);
  --sidebar-control-text: #575b6c;
  --sidebar-active-text: #5548d8;
  --sidebar-scroll: rgba(101,88,232,.2);
  --input: #ffffff;
  --table-head: #f5f5f9;
  --focus: #8c83ff;
  --shadow-xs: 0 1px 2px rgba(21, 23, 37, .05);
  --shadow-sm: 0 8px 24px rgba(29, 31, 50, .07);
  --shadow-md: 0 18px 50px rgba(22, 24, 42, .12);
  --shadow-lg: 0 28px 80px rgba(8, 10, 22, .22);
  --overlay: rgba(16, 18, 32, .72);
  --chart-grid: #d9dbe5;
  --sidebar-width: 282px;
  --sidebar-collapsed: 82px;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --content-max: 1540px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0e15;
  --bg-elevated: #11121b;
  --surface: #171822;
  --surface-soft: #1b1c28;
  --surface-strong: #242535;
  --border: #2d2f40;
  --border-strong: #3b3e52;
  --text: #e9e9f1;
  --text-strong: #ffffff;
  --muted: #9699aa;
  --muted-strong: #b4b6c4;
  --primary: #8c82ff;
  --primary-hover: #a198ff;
  --primary-soft: #292648;
  --primary-contrast: #0d0e15;
  --cyan: #43c8df;
  --cyan-soft: #18353e;
  --green: #3dd0a6;
  --green-soft: #173a31;
  --amber: #f1b44c;
  --amber-soft: #3d301a;
  --danger: #ff7186;
  --danger-hover: #ff8b9c;
  --danger-soft: #42232b;
  --input: #11121b;
  --table-head: #1d1e2a;
  --focus: #a79fff;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.25);
  --shadow-sm: 0 10px 30px rgba(0,0,0,.22);
  --shadow-md: 0 22px 60px rgba(0,0,0,.3);
  --shadow-lg: 0 30px 90px rgba(0,0,0,.5);
  --overlay: rgba(0,0,0,.78);
  --chart-grid: #343648;
  --sidebar: #171829;
  --sidebar-2: #1d1e32;
  --sidebar-text: #f6f6fb;
  --sidebar-muted: #a6a8bb;
  --sidebar-border: rgba(255,255,255,.08);
  --sidebar-control: rgba(255,255,255,.055);
  --sidebar-control-hover: rgba(255,255,255,.075);
  --sidebar-control-text: #d6d7e4;
  --sidebar-active-text: #ffffff;
  --sidebar-scroll: rgba(255,255,255,.17);
}

* { box-sizing: border-box; }
html, body { max-width: 100%; min-width: 0; }
html { background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 83% -10%, color-mix(in srgb, var(--primary), transparent 91%), transparent 34rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
body.nav-open { overflow: hidden; }
button, input, select, textarea { font: inherit; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; }
img, svg, canvas, video { max-width: 100%; height: auto; }
button, a, input, select, textarea { touch-action: manipulation; }
button, .btn { -webkit-tap-highlight-color: transparent; }
::selection { background: color-mix(in srgb, var(--primary), transparent 72%); }
[hidden] { display: none !important; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
.ui-icon { display: block; width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* App shell */
.layout { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  padding: 18px 14px 14px;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 2%, rgba(122,108,255,.23), transparent 15rem),
    linear-gradient(180deg, var(--sidebar-2), var(--sidebar));
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  box-shadow: 18px 0 55px rgba(14,15,30,.08);
  transition: width .24s ease, transform .24s ease;
}
.sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: .08;
  background-image: radial-gradient(rgba(255,255,255,.8) .6px, transparent .6px);
  background-size: 14px 14px;
  mask-image: linear-gradient(to bottom, black, transparent 70%);
}
.sidebar-head { flex: 0 0 auto; }
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 8px;
  color: var(--sidebar-text);
}
.brand:hover { color: var(--sidebar-text); }
.logo {
  position: relative;
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, #8578ff, #5d4fe3 58%, #19a985);
  box-shadow: 0 8px 22px rgba(94,80,226,.34), inset 0 1px 0 rgba(255,255,255,.25);
}
.logo::after { content: ""; position: absolute; inset: 3px; border: 1px solid rgba(255,255,255,.16); border-radius: 11px; }
.logo .ui-icon { width: 24px; height: 24px; stroke-width: 1.9; }
.brand-copy { display: grid; min-width: 0; line-height: 1.12; }
.brand-copy strong { font-size: 17px; letter-spacing: -.02em; }
.brand-copy small { margin-top: 4px; color: var(--sidebar-muted); font-size: 10px; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
.nav-toggle, .theme-toggle, .group-toggle, .nav-link {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  color: var(--sidebar-muted);
  background: transparent;
  cursor: pointer;
  transition: color .15s ease, background .15s ease, transform .15s ease;
}
.nav-toggle, .theme-toggle, .group-toggle, .nav-link, .group-label { display: flex; align-items: center; }
.nav-toggle { gap: 10px; margin: 12px 0 7px; padding: 9px 11px; background: var(--sidebar-control); color: var(--sidebar-control-text); }
.nav-toggle:hover, .theme-toggle:hover, .group-toggle:hover, .nav-link:hover { color: var(--sidebar-active-text); background: var(--sidebar-control-hover); }
.nav-main { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 0 3px 8px 0; scrollbar-width: thin; scrollbar-color: var(--sidebar-scroll) transparent; }
.nav-section-label { margin: 19px 11px 7px; color: var(--sidebar-muted); font-size: 10px; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.nav-icon { display: grid; flex: 0 0 22px; width: 22px; height: 22px; place-items: center; }
.nav-icon .ui-icon { width: 19px; height: 19px; }
.nav-link { position: relative; gap: 11px; margin: 2px 0; padding: 9px 11px; font-weight: 590; }
.nav-link.active { color: var(--sidebar-active-text); background: linear-gradient(90deg, rgba(127,113,255,.24), rgba(127,113,255,.08)); box-shadow: inset 0 0 0 1px rgba(142,130,255,.12); }
.nav-link.active::before { content: ""; position: absolute; left: -1px; width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: #8c82ff; box-shadow: 0 0 14px rgba(140,130,255,.8); }
.group-toggle { justify-content: space-between; padding: 9px 11px; font-weight: 690; text-align: left; }
.group-label { gap: 11px; min-width: 0; }
.group-chevron { display: grid; width: 18px; place-items: center; transition: transform .18s ease; }
.group-chevron .ui-icon { width: 15px; height: 15px; }
.nav-group.open .group-chevron { transform: rotate(180deg); }
.group-items { display: none; padding: 2px 0 2px 15px; }
.nav-group.open .group-items { display: block; }
.group-items .nav-link { font-size: 14px; }
.group-items .nav-link::after { content: ""; position: absolute; left: -9px; width: 1px; height: 100%; background: var(--sidebar-border); }
.sidebar-footer { flex: 0 0 auto; padding-top: 11px; border-top: 1px solid var(--sidebar-border); }
.theme-toggle { gap: 11px; padding: 9px 11px; text-align: left; }
.userbox { display: grid; grid-template-columns: 38px minmax(0,1fr) 44px; align-items: center; gap: 10px; margin-top: 9px; padding: 9px; border-radius: 14px; background: var(--sidebar-control); }
.user-avatar { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; background: linear-gradient(145deg, rgba(140,130,255,.95), rgba(49,181,154,.85)); color: #fff; font-weight: 850; }
.user-meta { display: grid; min-width: 0; line-height: 1.25; }
.user-meta strong { overflow: hidden; color: var(--sidebar-text); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.user-meta small { margin-top: 2px; color: var(--sidebar-muted); font-size: 11px; }
.logout-form { margin: 0; }
.logout-form .logout-link { min-height: 44px; padding: 0; border: 0; background: transparent; box-shadow: none; }
.logout-form .logout-link:hover { transform: none; }
.logout-link { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 10px; color: var(--sidebar-muted); }
.logout-link:hover { color: var(--sidebar-active-text); background: var(--sidebar-control-hover); }
.logout-link .ui-icon { width: 18px; height: 18px; }
.sidebar.collapsed { width: var(--sidebar-collapsed); padding-inline: 12px; }
.sidebar.collapsed .brand-copy, .sidebar.collapsed .nav-text, .sidebar.collapsed .user-meta { display: none; }
.sidebar.collapsed .brand, .sidebar.collapsed .nav-toggle, .sidebar.collapsed .theme-toggle, .sidebar.collapsed .group-toggle, .sidebar.collapsed .nav-link { justify-content: center; padding-inline: 9px; }
.sidebar.collapsed .brand { padding-inline: 0; }
.sidebar.collapsed .group-items { display: block; padding-left: 0; }
.sidebar.collapsed .group-toggle { margin-top: 8px; }
.sidebar.collapsed .group-items .nav-link::after { display: none; }
.sidebar.collapsed .userbox { grid-template-columns: 1fr; justify-items: center; padding: 7px; }
.sidebar.collapsed .logout-link { display: none; }

.content { min-height: 100vh; margin-left: var(--sidebar-width); width: calc(100% - var(--sidebar-width)); transition: margin-left .24s ease, width .24s ease; }
.sidebar.collapsed + .sidebar-backdrop + .content, .sidebar.collapsed ~ .content { margin-left: var(--sidebar-collapsed); width: calc(100% - var(--sidebar-collapsed)); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  padding: 10px clamp(18px, 2.2vw, 34px);
  border-bottom: 1px solid color-mix(in srgb, var(--border), transparent 18%);
  background: color-mix(in srgb, var(--bg), transparent 9%);
  backdrop-filter: blur(18px) saturate(1.25);
}
.topbar-start, .topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-location { display: grid; line-height: 1.12; }
.topbar-location strong { font-size: 15px; }
.topbar-kicker { margin-bottom: 3px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.system-status { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; background: color-mix(in srgb, var(--surface), transparent 8%); color: var(--muted-strong); font-size: 12px; font-weight: 670; box-shadow: var(--shadow-xs); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px color-mix(in srgb, var(--green), transparent 84%); }
.topbar-icon { display: grid; width: 44px; min-width: 44px; height: 44px; padding: 0; place-items: center; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); color: var(--muted-strong); box-shadow: var(--shadow-xs); cursor: pointer; }
.topbar-icon:hover { color: var(--primary); border-color: color-mix(in srgb, var(--primary), var(--border) 45%); }
.topbar-icon .ui-icon { width: 19px; height: 19px; }
.mobile-only { display: none; }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(12,14,27,.58); backdrop-filter: blur(3px); }
.sidebar-backdrop[hidden] { display: none !important; }
.wrap { width: min(var(--content-max), 100%); margin: 0 auto; padding: clamp(20px, 2.5vw, 38px) clamp(18px, 2.4vw, 38px) 56px; }

/* Type and shared surfaces */
h1, h2, h3, p { overflow-wrap: anywhere; }
h1, h2, h3 { margin-top: 0; color: var(--text-strong); letter-spacing: -.025em; }
h1 { margin-bottom: 8px; font-size: clamp(29px, 3vw, 42px); line-height: 1.08; }
h2 { margin-bottom: 15px; font-size: clamp(18px, 1.7vw, 23px); line-height: 1.18; }
h3 { font-size: 16px; }
p { margin-top: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.code, code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.eyebrow { margin: 0 0 6px; color: var(--primary); font-size: 10px; font-weight: 850; letter-spacing: .15em; text-transform: uppercase; }
.eyebrow-light { color: #bbb5ff; }
.title-icon, .section-icon, .btn-icon, .empty-icon, .alert-icon, .input-icon { display: inline-grid; place-items: center; color: currentColor; line-height: 1; }
.title-icon { width: 42px; height: 42px; margin-right: 9px; border: 1px solid color-mix(in srgb, var(--primary), transparent 75%); border-radius: 14px; background: var(--primary-soft); color: var(--primary); vertical-align: -.3em; }
.title-icon .ui-icon { width: 21px; height: 21px; }
.section-icon { width: 26px; height: 26px; margin-right: 7px; color: var(--primary); vertical-align: -.28em; }
.section-icon .ui-icon { width: 18px; height: 18px; }
.btn-icon { width: 18px; height: 18px; }
.btn-icon .ui-icon { width: 17px; height: 17px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.page-head > div { min-width: 0; }
.page-head p { max-width: 760px; margin: 0; }
.card {
  position: relative;
  min-width: 0;
  margin-bottom: 18px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.card > :last-child { margin-bottom: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr)); gap: 18px; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-head h2 { margin-bottom: 0; }
.section-badge { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 9px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 800; white-space: nowrap; }
.badge-warning { background: var(--amber-soft); color: var(--amber); }
.text-link { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; color: var(--muted-strong); font-size: 13px; font-weight: 720; }
.text-link:hover { color: var(--primary); }
.text-link .ui-icon { width: 15px; height: 15px; }

/* Buttons and status */
.btn, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-weight: 670;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: transform .14s ease, background .14s ease, border-color .14s ease, color .14s ease, box-shadow .14s ease;
}
.btn:hover, button:hover { border-color: color-mix(in srgb, var(--primary), var(--border) 50%); color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn.primary, button.primary { border-color: var(--primary); background: var(--primary); color: var(--primary-contrast); box-shadow: 0 8px 20px color-mix(in srgb, var(--primary), transparent 75%); }
.btn.primary:hover, button.primary:hover { border-color: var(--primary-hover); background: var(--primary-hover); color: var(--primary-contrast); }
.btn.danger, button.danger { border-color: color-mix(in srgb, var(--danger), transparent 20%); background: var(--danger-soft); color: var(--danger); box-shadow: none; }
.btn.danger:hover, button.danger:hover { border-color: var(--danger); background: var(--danger); color: #fff; }
.btn.warn { border-color: var(--amber); background: var(--amber); color: #16120b; }
.btn-small { min-height: 34px; padding: 6px 10px; font-size: 12px; }
.btn.disabled { opacity: .45; pointer-events: none; }
.actions, .action-bar, .action-buttons, .form-actions, .inline-toolbar, .pagination { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.actions form, .action-bar form, .action-buttons form { margin: 0; }
.action-bar { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; }
.form-actions, .pagination { margin-top: 18px; }
.pagination { justify-content: center; }
.pagination-status { color: var(--muted); font-size: 13px; font-weight: 700; }
.pill, .status-pill { display: inline-flex; align-items: center; min-height: 26px; margin: 2px; padding: 3px 9px; border: 1px solid color-mix(in srgb, var(--primary), transparent 82%); border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 760; line-height: 1.2; }
.status-neu, .status-in_benutzung, .status-booked { border-color: color-mix(in srgb, var(--green), transparent 75%); background: var(--green-soft); color: var(--green); }
.status-fast_leer, .critical-pill { border-color: color-mix(in srgb, var(--amber), transparent 68%); background: var(--amber-soft); color: var(--amber); }
.status-leer, .status-archiviert, .status-cancelled { border-color: color-mix(in srgb, var(--danger), transparent 72%); background: var(--danger-soft); color: var(--danger); }
.critical { background: color-mix(in srgb, var(--amber-soft), transparent 45%); }
.archived, .deleted { opacity: .62; }
.alert { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 18px; padding: 13px 15px; border: 1px solid; border-radius: 14px; font-weight: 630; box-shadow: var(--shadow-xs); }
.alert-icon { flex: 0 0 20px; width: 20px; height: 20px; margin-top: 1px; }
.alert-success { border-color: color-mix(in srgb, var(--green), transparent 65%); background: var(--green-soft); color: var(--green); }
.alert-danger { border-color: color-mix(in srgb, var(--danger), transparent 65%); background: var(--danger-soft); color: var(--danger); }
.alert-warning { border-color: color-mix(in srgb, var(--amber), transparent 60%); background: var(--amber-soft); color: color-mix(in srgb, var(--amber), var(--text) 20%); }

/* Forms */
label { display: block; margin: 0 0 6px; color: var(--muted-strong); font-size: 12px; font-weight: 760; }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  outline: none;
  background: var(--input);
  color: var(--text);
  line-height: 1.25;
  box-shadow: inset 0 1px 2px rgba(18,20,33,.025);
  transition: border-color .14s ease, box-shadow .14s ease, background .14s ease;
}
textarea { min-height: 110px; resize: vertical; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted), transparent 17%); }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--primary), var(--border) 72%); }
input:focus, select:focus, textarea:focus, button:focus-visible, .btn:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus), transparent 66%); outline-offset: 2px; border-color: var(--primary); }
input:disabled, select:disabled, textarea:disabled, input[readonly], textarea[readonly] { opacity: .68; background: var(--surface-strong); }
input[type="checkbox"], input[type="radio"] { width: 18px; min-width: 18px; height: 18px; min-height: 18px; padding: 0; accent-color: var(--primary); box-shadow: none; }
input[type="color"] { min-width: 70px; padding: 4px; }
.inline { display: inline-block; width: auto; }
.form-grid, form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 16px; align-items: end; }
.filter-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 176px), 1fr)); }
.form-field { min-width: 0; }
.form-field-wide { grid-column: span 2; }
.form-field p { margin: 6px 0 0; }
.filter-card { padding: 18px; background: color-mix(in srgb, var(--surface), var(--primary-soft) 13%); }
.summary-line { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.summary-line strong { color: var(--text); }
.inline-toolbar { margin-top: 0; }
.inline-toolbar label { margin: 0; }
.inline-toolbar select { width: auto; min-width: 112px; }
.checkbox-grid, .permission-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 9px; }
.checkbox-card { display: block; min-width: 0; min-height: 54px; padding: 10px 11px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-soft); cursor: pointer; }
.checkbox-card:hover { border-color: color-mix(in srgb, var(--primary), var(--border) 55%); }
.checkbox-line { display: flex; align-items: center; gap: 9px; min-height: 44px; margin-top: 20px; }
.sticky-actions { position: static; z-index: 15; justify-content: flex-end; padding: 10px; border: 1px solid color-mix(in srgb, var(--border), transparent 5%); border-radius: 15px; background: color-mix(in srgb, var(--surface), transparent 7%); box-shadow: var(--shadow-sm); }

/* Tables */
.table-wrap { max-width: 100%; overflow-x: auto; overflow-y: hidden; padding: 0; border-radius: var(--radius); -webkit-overflow-scrolling: touch; }
.table-wrap > h2 { padding: 20px 20px 0; }
table { width: 100%; border-collapse: separate; border-spacing: 0; background: transparent; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { background: var(--table-head); color: var(--muted-strong); font-size: 11px; font-weight: 790; letter-spacing: .025em; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: color-mix(in srgb, var(--primary-soft), transparent 54%); }
td > a:not(.btn):not(.external-link) { color: var(--text-strong); font-weight: 720; }
td > a:not(.btn):not(.external-link):hover { color: var(--primary); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.sort-link { display: inline-flex; align-items: center; gap: 5px; min-height: 34px; padding: 3px 4px; border-radius: 8px; color: inherit; }
.sort-link:hover { color: var(--primary); background: var(--primary-soft); }
.sort-link.active { color: var(--primary); font-weight: 850; }
.sort-indicator { color: var(--muted); font-size: 10px; }
.sort-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 15px; color: var(--muted); }
.external-link { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 44px; padding: 7px 12px; border: 1px solid color-mix(in srgb, var(--primary), transparent 72%); border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 760; }
.swatch { display: inline-block; width: 28px; height: 28px; border: 2px solid var(--surface); border-radius: 9px; vertical-align: middle; cursor: pointer; box-shadow: 0 0 0 1px var(--border-strong), inset 0 0 0 1px rgba(255,255,255,.35); }
.swatch.large { width: 54px; height: 54px; border-radius: 15px; }
.progressbar { width: 100%; height: 7px; overflow: hidden; border-radius: 999px; background: var(--surface-strong); }
.progressbar > span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #8f83ff); transition: width .45s ease; }
.table-wrap table { min-width: 100%; }
.inventory-table table { min-width: 1360px; }
table[data-resizable-table="spools"] { min-width: 1230px; }
.inventory-table th:nth-child(1), .inventory-table td:nth-child(1) { width: 170px; }
.inventory-table th:nth-child(2), .inventory-table td:nth-child(2) { width: 120px; }
.inventory-table th:nth-child(3), .inventory-table td:nth-child(3) { width: 90px; }
.inventory-table th:nth-child(4), .inventory-table td:nth-child(4) { width: 145px; }
.inventory-table th:nth-child(5), .inventory-table td:nth-child(5) { width: 140px; }
.inventory-table th:nth-child(6), .inventory-table td:nth-child(6) { width: 120px; }
.inventory-table th:nth-child(7), .inventory-table td:nth-child(7) { width: 112px; }
.inventory-table th:nth-child(8), .inventory-table td:nth-child(8) { width: 125px; }
.inventory-table th:nth-child(9), .inventory-table td:nth-child(9) { width: 130px; }
.inventory-table th:nth-child(10), .inventory-table td:nth-child(10) { width: 160px; }
.inventory-table th:nth-child(11), .inventory-table td:nth-child(11) { width: 92px; }
table.resizable-table { table-layout: fixed; }
table.resizable-table th, table.resizable-table td { overflow: hidden; text-overflow: ellipsis; }
table.resizable-table td { overflow-wrap: anywhere; }
table.resizable-table th[data-resizable-column] { position: relative; padding-right: 17px; user-select: none; }
.table-resize-handle { position: absolute; top: 0; right: -4px; z-index: 2; width: 10px; height: 100%; cursor: col-resize; touch-action: none; }
.table-resize-handle::after { content: ""; position: absolute; top: 8px; bottom: 8px; left: 4px; width: 2px; border-radius: 999px; background: var(--border-strong); opacity: .5; }
th[data-resizable-column]:hover .table-resize-handle::after, .table-resize-handle:focus-visible::after, body.table-resizing .table-resize-handle::after { opacity: 1; background: var(--primary); }
.table-resize-toolbar { display: flex; justify-content: flex-end; min-width: max-content; padding: 8px 8px 0; }
.table-resize-reset { min-height: 34px; padding: 6px 10px; border-color: transparent; color: var(--muted); font-size: 11px; box-shadow: none; }
body.table-resizing { cursor: col-resize; user-select: none; }

/* Dashboard */
.dashboard-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, .6fr);
  align-items: center;
  gap: 28px;
  min-height: 235px;
  margin-bottom: 18px;
  padding: clamp(26px, 4vw, 48px);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 85% 20%, rgba(70,203,186,.16), transparent 17rem),
    radial-gradient(circle at 5% 110%, rgba(130,115,255,.22), transparent 22rem),
    linear-gradient(125deg, #191a2e, #24213e 57%, #182b34);
  color: #d9d9e8;
  box-shadow: var(--shadow-md);
}
.dashboard-hero::before { content: ""; position: absolute; inset: 0; opacity: .16; background-image: radial-gradient(rgba(255,255,255,.75) .7px, transparent .7px); background-size: 18px 18px; mask-image: linear-gradient(100deg, black, transparent 68%); }
.hero-copy, .hero-actions { position: relative; z-index: 2; }
.hero-copy h1 { max-width: 700px; margin: 0 0 13px; color: #fff; font-size: clamp(33px, 4vw, 55px); line-height: 1.02; }
.hero-copy h1 span { color: #bdb8ff; }
.hero-copy > p:last-child { max-width: 610px; margin: 0; color: #b6b7c8; font-size: 15px; }
.hero-actions { display: grid; gap: 10px; }
.hero-btn { justify-content: flex-start; min-height: 64px; padding: 11px 14px; border-color: rgba(255,255,255,.12); background: rgba(255,255,255,.075); color: #f4f4fa; box-shadow: none; backdrop-filter: blur(10px); }
.hero-btn:hover { border-color: rgba(255,255,255,.24); background: rgba(255,255,255,.12); color: #fff; }
.hero-btn-primary { background: #7365ef; border-color: #8275f5; }
.hero-btn-primary:hover { background: #8174f5; }
.hero-btn .btn-icon { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 11px; background: rgba(255,255,255,.11); }
.hero-btn > span:last-child { display: grid; text-align: left; }
.hero-btn strong { font-size: 13px; }
.hero-btn small { margin-top: 2px; color: #c2c3d0; font-size: 11px; font-weight: 520; }
.hero-orbit { position: absolute; right: 21%; bottom: -106px; width: 265px; height: 265px; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; }
.hero-orbit::before, .hero-orbit::after { content: ""; position: absolute; border: 1px solid rgba(255,255,255,.06); border-radius: 50%; }
.hero-orbit::before { inset: 34px; }.hero-orbit::after { inset: 72px; }
.hero-orbit span { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: #897dff; box-shadow: 0 0 18px #897dff; }
.hero-orbit span:nth-child(1) { top: 24px; left: 58px; }.hero-orbit span:nth-child(2) { top: 65px; right: 21px; background: #2fc5a4; box-shadow: 0 0 18px #2fc5a4; }.hero-orbit span:nth-child(3) { top: 112px; left: 65px; background: #e9a73f; box-shadow: 0 0 18px #e9a73f; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { display: grid; grid-template-columns: 48px minmax(0,1fr); align-items: center; gap: 12px; min-height: 132px; margin-bottom: 0; overflow: hidden; }
.stat-icon { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 14px; color: var(--primary); background: var(--primary-soft); }
.stat-icon .ui-icon { width: 23px; height: 23px; }
.stat-content { display: grid; min-width: 0; }
.stat-label { color: var(--muted); font-size: 11px; font-weight: 760; }
.stat { margin-top: 3px; color: var(--text-strong); font-size: clamp(25px, 2.3vw, 35px); font-weight: 820; letter-spacing: -.045em; line-height: 1.05; }
.stat-weight { font-size: clamp(19px, 1.75vw, 27px); }
.stat-content small { margin-top: 6px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.stat-accent { position: absolute; right: -24px; bottom: -36px; width: 92px; height: 92px; border-radius: 50%; background: color-mix(in srgb, var(--primary), transparent 93%); }
.stat-cyan .stat-icon { color: var(--cyan); background: var(--cyan-soft); }.stat-cyan .stat-accent { background: color-mix(in srgb, var(--cyan), transparent 92%); }
.stat-amber .stat-icon { color: var(--amber); background: var(--amber-soft); }.stat-amber .stat-accent { background: color-mix(in srgb, var(--amber), transparent 91%); }
.stat-green .stat-icon { color: var(--green); background: var(--green-soft); }.stat-green .stat-accent { background: color-mix(in srgb, var(--green), transparent 92%); }
.stat-attention { border-color: color-mix(in srgb, var(--amber), transparent 65%); }
.consumption-chart-card { padding: clamp(19px, 2.2vw, 27px); overflow: hidden; }
.consumption-chart-card::before { content: ""; position: absolute; right: -130px; top: -150px; width: 320px; height: 320px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--primary), transparent 86%), transparent 68%); pointer-events: none; }
.chart-head { position: relative; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.chart-head h2 { margin-bottom: 6px; }
.chart-meta { margin: 0; }
.range-tabs { display: flex; align-items: stretch; gap: 5px; flex-wrap: wrap; }
.range-tab, .history-sort-pill { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 7px 11px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-soft); color: var(--muted-strong); font-size: 11px; font-weight: 720; }
.range-tab:hover, .history-sort-pill:hover { border-color: color-mix(in srgb, var(--primary), transparent 60%); color: var(--primary); }
.range-tab.active, .history-sort-pill.active { border-color: var(--primary); background: var(--primary); color: var(--primary-contrast); box-shadow: 0 7px 17px color-mix(in srgb, var(--primary), transparent 79%); }
.line-chart-wrap { position: relative; margin-top: 18px; padding: 8px 3px 1px; overflow-x: auto; }
.line-chart { display: block; width: 100%; min-width: min(760px,100%); height: auto; padding: 4px; border: 1px solid var(--border); border-radius: 17px; aspect-ratio: 264/70; color: var(--primary); background: linear-gradient(180deg, color-mix(in srgb, var(--primary), transparent 95%), transparent 65%), var(--surface-soft); }
.axis { stroke: var(--border-strong); stroke-width: .5; }
.chart-grid-line { stroke: var(--chart-grid); stroke-width: .28; stroke-dasharray: 1.2 1.6; opacity: .7; }
.chart-guide-label { fill: var(--muted); font-size: 3.1px; font-weight: 650; }
.chart-area { fill: url(#consumptionArea); color: var(--primary); }
.line-series { fill: none; stroke: var(--primary); stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1.5px 2px color-mix(in srgb, var(--primary), transparent 56%)); }
.line-point-hit { fill: transparent; stroke: transparent; cursor: pointer; }
.line-point-focus { fill: color-mix(in srgb, var(--primary), transparent 76%); stroke: none; opacity: 0; transition: opacity .12s ease; }
.line-point { fill: var(--surface); stroke: var(--primary); stroke-width: .85; }
.chart-point-group:hover .line-point-focus, .chart-point-group:focus .line-point-focus { opacity: 1; }
.chart-point-group:focus { outline: none; }
.chart-labels { display: flex; align-items: flex-start; justify-content: space-between; min-width: min(760px,100%); margin-top: 5px; padding: 0 1.2%; color: var(--muted); font-size: 9px; text-align: center; }
.chart-labels span { flex: 0 1 auto; min-width: 0; }
.chart-tooltip { position: absolute; z-index: 5; display: grid; min-width: 140px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 11px; background: var(--text-strong); color: var(--surface); box-shadow: var(--shadow-md); pointer-events: none; transform: translate(-50%, calc(-100% - 10px)); }
.chart-tooltip.below { transform: translate(-50%, 10px); }
.chart-tooltip[hidden] { display: none !important; }
.chart-tooltip strong { font-size: 12px; }.chart-tooltip span { margin-top: 2px; font-size: 11px; opacity: .72; }
.chart-help { margin: 10px 0 0; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0,.9fr) minmax(0,1.1fr); gap: 18px; }
.material-list, .reorder-list, .recent-list { display: grid; }
.material-row { display: grid; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.material-row:last-child { border-bottom: 0; }
.material-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.material-meta strong { font-size: 13px; }.material-meta span { color: var(--muted); font-size: 11px; text-align: right; }
.material-progress > span { background: linear-gradient(90deg, var(--primary), var(--cyan)); }
.reorder-row, .recent-row { display: grid; align-items: center; gap: 12px; min-width: 0; border-bottom: 1px solid var(--border); color: var(--text); transition: background .12s ease; }
.reorder-row { grid-template-columns: 38px minmax(0,1fr) auto; padding: 11px 3px; }
.reorder-row:last-child, .recent-row:last-child { border-bottom: 0; }
.reorder-row:hover, .recent-row:hover { color: var(--text); background: color-mix(in srgb, var(--primary-soft), transparent 45%); }
.spool-color { width: 34px; height: 34px; border-radius: 11px; }
.reorder-main, .reorder-weight, .recent-date, .recent-job { display: grid; min-width: 0; }
.reorder-main strong, .recent-job strong { overflow: hidden; color: var(--text-strong); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.reorder-main small, .reorder-weight small, .recent-date small, .recent-job small { margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.reorder-weight { text-align: right; }.reorder-weight strong { color: var(--amber); font-size: 13px; }
.recent-card { padding-bottom: 9px; }
.recent-row { grid-template-columns: minmax(95px,.45fr) minmax(0,1.5fr) minmax(90px,.45fr) 20px; min-height: 62px; padding: 9px 3px; }
.recent-date strong { font-size: 12px; }.recent-total { justify-self: end; font-size: 12px; font-weight: 780; }.recent-arrow { color: var(--muted); }.recent-arrow .ui-icon { width: 15px; }
.empty-compact { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 105px; color: var(--muted); text-align: left; }
.empty-compact > span { display: grid; flex: 0 0 38px; width: 38px; height: 38px; place-items: center; border-radius: 12px; background: var(--surface-strong); color: var(--muted-strong); }
.empty-compact > span .ui-icon { width: 19px; height: 19px; }
.empty-compact p { margin: 0; font-size: 12px; }
.empty-compact strong { color: var(--text); font-size: 13px; }.success-empty > span { background: var(--green-soft); color: var(--green); }

/* Consumption history */
.history-head { margin-bottom: 18px; }
.history-controls { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.history-page-size, .history-sortbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.history-page-size label { margin: 0; }
.history-page-size select { width: auto; min-width: 82px; }
.history-list { display: grid; gap: 11px; margin-top: 14px; }
.history-entry { display: grid; grid-template-columns: minmax(92px,.45fr) minmax(0,1.45fr) minmax(132px,.6fr) minmax(160px,auto); gap: 18px; align-items: center; margin-bottom: 0; padding: 16px 18px; }
.history-entry-cancelled { opacity: .64; }
.history-date-block, .history-entry-main, .history-entry-meta { display: grid; min-width: 0; }
.history-date-block time { font-weight: 820; }.history-entry-id { color: var(--muted); font-size: 10px; }
.history-entry-main h2 { margin: 0 0 7px; font-size: 15px; }.history-entry-main h2 a { display: inline-flex; align-items: center; min-width: 44px; min-height: 44px; color: var(--text-strong); }
.history-spools { display: flex; flex-wrap: wrap; gap: 5px; }
.history-spool-chip { display: inline-flex; align-items: center; justify-content: space-between; gap: 10px; max-width: 100%; min-height: 34px; padding: 5px 9px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-soft); color: var(--text); font-size: 11px; }
.history-spool-chip:hover { border-color: color-mix(in srgb, var(--primary), var(--border) 50%); color: var(--primary); }
.history-entry-meta { gap: 7px; }.history-total { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }.history-total span, .history-user { color: var(--muted); font-size: 10px; }.history-total strong { font-size: 14px; }
.history-actions { justify-content: flex-end; }

/* Spool picker, forms and detail */
.spool-form { display: grid; gap: 15px; max-width: 1180px; }
.form-section { margin-bottom: 0; padding: 22px; }
.form-section h2 { padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.color-form-grid { grid-template-columns: minmax(210px,1fr) minmax(280px,1.35fr) minmax(180px,.72fr); }
.color-picker-row { display: flex; align-items: center; gap: 10px; }
.consumption-line { display: grid; grid-template-columns: minmax(230px,1fr) 140px auto; gap: 10px; align-items: end; margin: 10px 0; }
.spool-select, .multi-select { position: relative; min-width: 0; }
.spool-select-button, .multi-select-trigger { width: 100%; justify-content: space-between; background: var(--input); border-color: var(--border-strong); box-shadow: inset 0 1px 2px rgba(18,20,33,.025); }
.spool-select-name, .spool-select-meta, .multi-select-placeholder { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.spool-select-weight { flex: 0 0 auto; margin-left: 10px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.spool-select-menu, .multi-select-panel { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 50; display: none; max-height: 340px; overflow: auto; padding: 6px; border: 1px solid var(--border-strong); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-md); }
.spool-select.open .spool-select-menu, .multi-select.open .multi-select-panel { display: block; }
.spool-select-search-row { position: sticky; top: -6px; z-index: 1; margin: -6px -6px 5px; padding: 6px; border-bottom: 1px solid var(--border); background: var(--surface); }
.spool-select-search, .multi-select-search { min-height: 40px; }
.spool-select-empty { padding: 10px; color: var(--muted); text-align: center; }
.spool-option { width: 100%; justify-content: space-between; min-height: 50px; padding: 8px 9px; border: 0; border-radius: 10px; background: transparent; color: var(--text); box-shadow: none; text-align: left; }
.spool-option:hover, .spool-option:focus-visible, .spool-option.active { background: var(--primary-soft); color: var(--text); transform: none; }
.spool-option-main { display: flex; align-items: center; gap: 9px; min-width: 0; }
.spool-option-swatch { flex: 0 0 24px; width: 24px; height: 24px; border: 2px solid var(--surface); border-radius: 8px; box-shadow: 0 0 0 1px var(--border-strong); }
.spool-option-text { display: grid; min-width: 0; }.spool-select-meta { color: var(--muted); font-size: 10px; }
.multi-select-options { display: grid; gap: 3px; }
.multi-select-option { display: flex; align-items: center; gap: 9px; min-height: 42px; margin: 0; padding: 7px 8px; border-radius: 9px; cursor: pointer; }
.multi-select-option:hover { background: var(--primary-soft); }
.multi-select-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.multi-chip { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; padding: 2px 3px 2px 10px; border: 1px solid color-mix(in srgb, var(--primary), transparent 75%); border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 720; }
.multi-chip button { min-width: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; box-shadow: none; }
.spool-detail-head { align-items: center; }
.spool-detail-head h1 { margin-bottom: 0; }
.spool-detail-card table th { width: 180px; background: transparent; }
.spool-title-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.spool-profile { display: grid; grid-template-columns: 150px minmax(190px,.55fr) minmax(320px,1fr); align-items: center; gap: 28px; padding: 26px; overflow: hidden; }
.spool-profile::after { content: ""; position: absolute; right: -80px; top: -105px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle,color-mix(in srgb,var(--primary),transparent 88%),transparent 68%); pointer-events: none; }
.spool-visual { position: relative; display: grid; width: 134px; height: 134px; place-items: center; border-radius: 50%; background: var(--surface-soft); box-shadow: inset 0 0 0 1px var(--border), 0 12px 30px color-mix(in srgb,var(--text),transparent 90%); }
.spool-visual::before, .spool-visual::after { content: ""; position: absolute; border: 1px solid color-mix(in srgb,var(--border-strong),transparent 15%); border-radius: 50%; pointer-events: none; }
.spool-visual::before { inset: 17px; }.spool-visual::after { inset: 37px; }
.spool-visual-color { position: absolute; inset: 8px; width: auto; height: auto; border: 7px solid var(--surface); border-radius: 50%; box-shadow: 0 0 0 1px var(--border-strong); }
.spool-visual .spool-visual-color { width: auto; height: auto; border-radius: 50%; }
.spool-visual-core { position: relative; z-index: 2; display: grid; width: 44px; height: 44px; place-items: center; border-radius: 50%; background: color-mix(in srgb,var(--surface),transparent 6%); color: var(--text); backdrop-filter: blur(10px); box-shadow: 0 5px 18px rgba(0,0,0,.12); pointer-events: none; }
.spool-visual-core .ui-icon { width: 25px; height: 25px; }
.spool-profile-main { min-width: 0; }.spool-profile-main h2 { margin-bottom: 5px; font-size: 27px; }.spool-profile-main code { color: var(--muted); font-size: 12px; }.spool-groups { margin-top: 10px; }
.spool-stock { position: relative; z-index: 1; min-width: 0; }.stock-head, .stock-scale { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }.stock-head span { color: var(--muted); font-size: 11px; font-weight: 720; }.stock-head strong { font-size: clamp(24px,2.6vw,38px); letter-spacing: -.04em; }.stock-progress { height: 11px; margin: 13px 0 7px; }.stock-progress > span { background: linear-gradient(90deg,var(--green),var(--cyan)); }.stock-progress-critical > span { background: linear-gradient(90deg,var(--danger),var(--amber)); }.stock-scale { color: var(--muted); font-size: 9px; }
.spool-detail-grid { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(280px,.8fr); gap: 18px; }.detail-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 22px; margin: 0; }.detail-list > div { display: grid; grid-template-columns: minmax(100px,.7fr) minmax(0,1fr); gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }.detail-list > div:nth-last-child(-n+2) { border-bottom: 0; }.detail-list dt { color: var(--muted); font-size: 11px; font-weight: 720; }.detail-list dd { margin: 0; color: var(--text-strong); font-weight: 680; }.spool-notes { min-height: 130px; color: var(--muted-strong); white-space: pre-wrap; }.spool-history-card { padding-bottom: 0; }.spool-history-card .table-wrap { margin-inline: -20px; width: calc(100% + 40px); max-width: calc(100% + 40px); }

.consumption-form { display: grid; gap: 25px; max-width: 1180px; padding: 24px; }.consumption-form > section + section { padding-top: 22px; border-top: 1px solid var(--border); }.consumption-form .section-head { margin-bottom: 14px; }.consumption-form .section-head h2 { margin-bottom: 0; }.consumption-form .section-head p:last-child { margin: 5px 0 0; }.consumption-lines { display: grid; gap: 8px; }.consumption-actions { justify-content: flex-end; padding-top: 20px; border-top: 1px solid var(--border); }

/* Colors, roles, admin and audit */
.color-list { display: grid; gap: 7px; }
.color-list-head, .color-row { display: grid; grid-template-columns: 58px minmax(140px,1fr) minmax(110px,auto); align-items: center; gap: 12px; }
.color-list-head { padding: 0 8px 8px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 11px; font-weight: 780; }
.color-row { min-height: 66px; padding: 8px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-soft); transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease; }
.color-row:hover { border-color: color-mix(in srgb, var(--primary), var(--border) 48%); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.color-chip { width: 46px; height: 46px; border-radius: 13px; }
.color-name { overflow-wrap: anywhere; }.color-code { justify-self: start; padding: 4px 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 11px; font-weight: 780; }
.empty-state { padding: 44px 22px; text-align: center; }
.empty-icon { width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 16px; background: var(--primary-soft); color: var(--primary); }
.empty-icon .ui-icon { width: 25px; height: 25px; }
.permission-section { margin: 12px 0 0; padding: 13px 14px 5px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-soft); }
.permission-section > legend { padding: 0 6px; color: var(--muted); font-size: 11px; font-weight: 800; }
.role-create-form { display: grid; gap: 14px; }.role-create-basics { display: grid; grid-template-columns: minmax(220px,.65fr) minmax(300px,1.35fr); gap: 16px; align-items: end; max-width: 920px; }.role-create-actions { justify-content: flex-end; }
.role-create-disclosure { padding: 0; overflow: hidden; }
.role-create-disclosure > summary { display: grid; grid-template-columns: 42px minmax(0,1fr) 24px; align-items: center; gap: 12px; min-height: 76px; padding: 15px 18px; cursor: pointer; list-style: none; }
.role-create-disclosure > summary::-webkit-details-marker { display: none; }
.role-create-disclosure > summary:hover { background: var(--primary-soft); }
.role-create-disclosure[open] > summary { border-bottom: 1px solid var(--border); background: var(--primary-soft); }
.role-create-disclosure .summary-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; background: var(--primary); color: var(--primary-contrast); }
.role-create-disclosure .summary-icon .ui-icon { width: 20px; height: 20px; }
.role-create-disclosure summary > span:nth-child(2) { display: grid; }
.role-create-disclosure summary strong { color: var(--text-strong); }
.role-create-disclosure summary small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.summary-chevron { color: var(--muted); transition: transform .18s ease; }
.role-create-disclosure[open] .summary-chevron { transform: rotate(180deg); }
.role-create-body { padding: 18px; }
.role-summary-badges { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.user-create-form { display: grid; gap: 16px; }.users-card { min-width: 0; padding-bottom: 0; overflow: hidden; }.users-card .table-wrap { width: calc(100% + 40px); max-width: calc(100% + 40px); margin-inline: -20px; }.users-table { min-width: 1160px; }.checkbox-hitbox { display: inline-grid; width: 44px; height: 44px; place-items: center; border-radius: 10px; cursor: pointer; }.checkbox-hitbox:hover { background: var(--primary-soft); }
.accordion-list { display: grid; gap: 9px; }.role-accordion { overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-soft); }
.role-accordion > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 15px; cursor: pointer; list-style: none; }.role-accordion > summary::-webkit-details-marker { display: none; }.role-accordion[open] > summary { border-bottom: 1px solid var(--border); background: var(--primary-soft); }
.role-summary-main { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; }.role-edit-form { padding: 16px; }
.audit-table { table-layout: auto; }.audit-details-toggle-cell { white-space: nowrap; }.audit-details-toggle { min-height: 34px; padding: 4px 8px; border: 0; background: transparent; color: var(--primary); box-shadow: none; font-size: 11px; }.audit-details-toggle:hover { background: var(--primary-soft); transform: none; }
.audit-details-row[hidden] { display: none; }.audit-details-row td { padding: 0 12px 12px; overflow: visible; background: var(--surface-soft); }.audit-details-panel { max-width: 100%; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); }.audit-details-panel pre { max-width: 100%; max-height: 320px; margin: 0; padding: 11px 13px; overflow: auto; color: var(--text); font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Modal */
.color-modal { position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center; padding: 18px; background: var(--overlay); backdrop-filter: blur(8px); }
.color-modal.open { display: flex; }.color-dialog { width: min(410px, 94vw); padding: 20px; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); text-align: center; box-shadow: var(--shadow-lg); }.modal-grip { width: 38px; height: 4px; margin: -7px auto 15px; border-radius: 999px; background: var(--border-strong); }.color-preview { height: min(58vw,250px); margin: 12px 0; border: 1px solid var(--border-strong); border-radius: 17px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }.color-value { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 16px; font-weight: 750; }

/* Login */
.auth-page { background: #12131f; }
.auth-wrap { min-height: 100vh; }
.auth-shell { display: grid; grid-template-columns: minmax(0,1.18fr) minmax(420px,.82fr); min-height: 100vh; }
.auth-visual { position: relative; display: flex; flex-direction: column; justify-content: space-between; min-width: 0; padding: clamp(28px,5vw,70px); overflow: hidden; background: radial-gradient(circle at 65% 38%, rgba(99,87,232,.34), transparent 24rem), radial-gradient(circle at 20% 90%, rgba(19,175,141,.2), transparent 27rem), linear-gradient(135deg,#171829,#20213a 58%,#142a2e); color: #fff; }
.auth-visual::before { content: ""; position: absolute; inset: 0; opacity: .13; background-image: radial-gradient(rgba(255,255,255,.85) .7px, transparent .7px); background-size: 18px 18px; mask-image: linear-gradient(145deg, black, transparent 85%); }
.auth-brand, .auth-message { position: relative; z-index: 2; }.auth-brand { display: flex; align-items: center; gap: 12px; }.logo-large { width: 48px; height: 48px; }.auth-brand > span:last-child { display: grid; line-height: 1.12; }.auth-brand strong { font-size: 18px; }.auth-brand small { margin-top: 4px; color: #a9aabe; font-size: 10px; font-weight: 760; letter-spacing: .14em; text-transform: uppercase; }
.auth-message { max-width: 630px; }.auth-message h1 { margin: 0 0 18px; color: #fff; font-size: clamp(46px,6vw,82px); line-height: .94; }.auth-message p { max-width: 520px; margin: 0; color: #b7b8c8; font-size: 16px; }
.filament-orbit { position: absolute; top: 50%; right: -1%; width: min(43vw,560px); aspect-ratio: 1; transform: translateY(-55%); }.orbit-ring { position: absolute; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; }.orbit-ring-one { inset: 0; }.orbit-ring-two { inset: 17%; border-width: 22px; border-color: rgba(118,103,240,.12); box-shadow: inset 0 0 70px rgba(86,73,205,.14), 0 0 60px rgba(86,73,205,.1); }.orbit-core { position: absolute; inset: 38%; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; background: rgba(255,255,255,.055); color: #c6c2ff; backdrop-filter: blur(12px); }.orbit-core .ui-icon { width: 46%; height: 46%; }.orbit-swatch { position: absolute; width: 14px; height: 14px; border: 3px solid rgba(255,255,255,.7); border-radius: 50%; }.swatch-violet { top: 11%; left: 26%; background:#8376ff; box-shadow:0 0 24px #8376ff; }.swatch-cyan { top: 27%; right: 6%; background:#28c5b0; box-shadow:0 0 24px #28c5b0; }.swatch-amber { bottom: 7%; left: 33%; background:#eead3f; box-shadow:0 0 24px #eead3f; }
.auth-panel { display: grid; place-items: center; padding: clamp(24px,5vw,76px); background: var(--bg-elevated); }
.auth-card { width: min(100%, 430px); }.auth-card-head { margin-bottom: 28px; }.auth-card-head h1 { margin: 0 0 8px; font-size: 40px; }.auth-card-head p:last-child { margin: 0; }.auth-mobile-logo { display: none; }
.auth-form { display: grid; gap: 17px; }.input-shell { position: relative; }.input-shell input { padding-left: 43px; min-height: 50px; }.input-icon { position: absolute; left: 13px; top: 50%; z-index: 1; width: 19px; height: 19px; color: var(--muted); transform: translateY(-50%); }.input-icon .ui-icon { width: 18px; height: 18px; }
.auth-submit { justify-content: space-between; width: 100%; min-height: 52px; margin-top: 4px; padding-inline: 17px; }.auth-security { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 24px; color: var(--muted); font-size: 11px; font-weight: 650; }.auth-security > span:first-child { display: grid; width: 16px; height: 16px; place-items: center; }.auth-security .ui-icon { width: 15px; height: 15px; }

/* Responsive */
@media (max-width: 1240px) {
  .stat-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .history-entry { grid-template-columns: minmax(90px,.45fr) minmax(0,1fr); }
  .history-entry-meta { grid-column: 1; }.history-actions { grid-column: 2; justify-content: flex-start; }
  .auth-message h1 { font-size: clamp(42px,6vw,68px); }
}

@media (max-width: 1040px) {
  .dashboard-hero { grid-template-columns: 1fr; }.hero-actions { grid-template-columns: repeat(2,minmax(0,1fr)); }.hero-orbit { right: -60px; bottom: -130px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .color-form-grid { grid-template-columns: 1fr 1fr; }.color-picker-field { grid-column: 1/-1; }
  .auth-shell { grid-template-columns: minmax(0,1fr) minmax(390px,.9fr); }.filament-orbit { right: -18%; }
  .spool-profile { grid-template-columns: 130px minmax(0,1fr); }.spool-stock { grid-column: 1/-1; }.spool-detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .sidebar { visibility: hidden; width: min(88vw,320px); max-width: calc(100vw - 18px); transform: translateX(-100%); pointer-events: none; box-shadow: 24px 0 70px rgba(0,0,0,.35); }
  .sidebar.open { visibility: visible; transform: translateX(0); pointer-events: auto; }
  .sidebar.collapsed { width: min(88vw,320px); padding-inline: 14px; }
  .sidebar.collapsed .brand-copy, .sidebar.collapsed .nav-text, .sidebar.collapsed .user-meta { display: grid; }
  .sidebar.collapsed .nav-toggle, .sidebar.collapsed .theme-toggle, .sidebar.collapsed .group-toggle, .sidebar.collapsed .nav-link { justify-content: flex-start; padding-inline: 11px; }
  .sidebar.collapsed .group-toggle { justify-content: space-between; }.sidebar.collapsed .group-items { padding-left: 15px; }.sidebar.collapsed .userbox { grid-template-columns: 38px minmax(0,1fr) 36px; justify-items: stretch; }.sidebar.collapsed .logout-link { display: grid; }
  .content, .sidebar.collapsed ~ .content { width: 100%; margin-left: 0; }
  .mobile-only { display: grid; }
  .topbar { min-height: 62px; padding: max(8px,env(safe-area-inset-top)) 12px 8px; }
  .topbar-location strong { font-size: 13px; }.topbar-kicker { font-size: 9px; }.system-status { display: none; }
  .wrap { padding: 18px max(12px,env(safe-area-inset-right)) 40px max(12px,env(safe-area-inset-left)); }
  h1 { font-size: clamp(27px,7vw,36px); }
  .page-head { display: grid; gap: 13px; }.page-head > .btn, .page-head > .action-bar { width: 100%; }.page-head > .btn { justify-content: center; }
  .card { padding: 16px; border-radius: 15px; }
  .form-grid, .filter-grid, form .row { grid-template-columns: 1fr; }.form-field-wide { grid-column: auto; }.color-form-grid { grid-template-columns: 1fr; }.color-picker-field { grid-column: auto; }
  .btn, button, input, select, textarea, .spool-select-button, .multi-select-trigger { min-height: 46px; font-size: 16px; }.btn, button { padding: 10px 13px; }
  .form-actions > *, .pagination > * { flex: 1 1 auto; }
  .inline-toolbar { display: grid; grid-template-columns: 1fr; }.inline-toolbar select { width: 100%; }
  .table-wrap { margin-inline: -2px; border-radius: 13px; }.table-wrap table { min-width: max-content; } th,td { padding: 11px 12px; }
  .inventory-table::before, .table-wrap:has(table[data-resizable-table="spools"])::before, .spool-history-card .table-wrap::before, .users-card .table-wrap::before { content: "Seitlich scrollen für alle Details →"; position: sticky; left: 0; display: block; width: max-content; margin: 10px 10px 4px; padding: 5px 9px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-soft); color: var(--muted); font-size: 11px; font-weight: 700; }
  .inventory-table table.resizable-table th:first-child, .inventory-table td:first-child, table[data-resizable-table="spools"] th:first-child, table[data-resizable-table="spools"] td:first-child { position: sticky; left: 0; z-index: 2; background: var(--surface); box-shadow: 1px 0 0 var(--border); }
  .inventory-table table.resizable-table th:first-child, table[data-resizable-table="spools"] th:first-child { z-index: 3; background: var(--table-head); }
  .inventory-table tr.critical td:first-child, table[data-resizable-table="spools"] tr.critical td:first-child { background: var(--amber-soft); }
  .table-resize-handle, .table-resize-toolbar { display: none; } table.resizable-table { table-layout: auto; }
  .dashboard-hero { min-height: 0; padding: 25px 20px; }.hero-copy h1 { font-size: clamp(32px,9vw,44px); }.hero-actions { grid-template-columns: 1fr; }.hero-orbit { opacity: .45; }
  .range-tabs { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); width: 100%; }.range-tab { min-height: 44px; text-align: center; }
  .line-chart, .chart-labels { min-width: 580px; }
  .history-controls { display: grid; }.history-page-size { display: grid; grid-template-columns: 1fr; }.history-page-size select, .history-page-size button { width: 100%; }.history-sortbar { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }.history-sortbar > .muted { grid-column: 1/-1; }.history-sort-pill { min-height: 44px; }
  .history-entry { grid-template-columns: 1fr; gap: 11px; padding: 14px; }.history-date-block { display: flex; align-items: center; justify-content: space-between; }.history-entry-meta, .history-actions { grid-column: auto; }.history-entry-meta { grid-template-columns: 1fr auto; align-items: center; }.history-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); justify-content: stretch; }.history-actions .btn, .history-actions button, .history-actions form { width: 100%; }.history-entry-main h2 a { min-height: 44px; }.history-spools { display: grid; }.history-spool-chip { min-height: 44px; border-radius: 12px; }
  .consumption-line { grid-template-columns: 1fr; padding: 12px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-soft); }.consumption-line .remove-line { width: 100%; }
  .consumption-form { padding: 16px; }.consumption-items-section .section-head { display: grid; }.consumption-items-section .section-head button { width: 100%; }.consumption-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .spool-profile { grid-template-columns: 96px minmax(0,1fr); gap: 16px; padding: 18px; }.spool-visual { width: 92px; height: 92px; }.spool-visual::before { inset: 13px; }.spool-visual::after { inset: 27px; }.spool-visual-color { inset: 6px; border-width: 5px; }.spool-visual-core { width: 34px; height: 34px; }.spool-visual-core .ui-icon { width: 19px; height: 19px; }.spool-profile-main h2 { font-size: 21px; }.detail-list { grid-template-columns: 1fr; }.detail-list > div:nth-last-child(-n+2) { border-bottom: 1px solid var(--border); }.detail-list > div:last-child { border-bottom: 0; }.spool-history-card .table-wrap, .users-card .table-wrap { margin-inline: -16px; width: calc(100% + 32px); max-width: calc(100% + 32px); }
  .spool-select-menu { position: fixed; left: 12px; right: 12px; top: 14vh; max-height: 70vh; }.multi-select-panel { position: static; margin-top: 6px; box-shadow: none; }
  .sticky-actions { position: static; }.action-bar { flex-wrap: wrap; overflow: visible; }.action-bar .btn, .action-bar button { flex: 1 1 auto; }
  .role-create-basics { grid-template-columns: 1fr; }.permission-grid, .checkbox-grid { grid-template-columns: 1fr; }.role-accordion > summary { align-items: flex-start; flex-wrap: wrap; }
  .role-list-head { display: grid; }.role-list-head .sort-toolbar { margin-bottom: 0; }.role-summary-badges { width: 100%; }
  .sort-link, .text-link { min-height: 44px; }
  .recent-list .recent-row:nth-child(n+6) { display: none; }
  .swatch { width: 44px; height: 44px; border-radius: 11px; }.swatch.large { width: 58px; height: 58px; }
  .auth-shell { grid-template-columns: 1fr; }.auth-visual { display: none; }.auth-panel { min-height: 100vh; padding: 28px 20px; }.auth-card { max-width: 460px; }.auth-mobile-logo { display: grid; margin-bottom: 27px; }.auth-card-head h1 { font-size: 36px; }
}

@media (max-width: 620px) {
  .stat-grid { grid-template-columns: 1fr; }.stat-card { min-height: 112px; }.stat-content small { white-space: normal; }
  .hero-actions { gap: 8px; }.hero-btn { min-height: 60px; }
  .material-meta { display: grid; gap: 2px; }.material-meta span { text-align: left; }
  .recent-row { grid-template-columns: minmax(85px,.55fr) minmax(0,1.45fr) 18px; }.recent-total { grid-column: 2; grid-row: 2; justify-self: start; color: var(--primary); }.recent-arrow { grid-column: 3; grid-row: 1/3; }
  .section-head { align-items: flex-start; }.section-head .text-link { min-height: 44px; }
  .color-list-head { display: none; }.color-row { grid-template-columns: 50px minmax(0,1fr); }.color-row .color-code { grid-column: 2; }
  .spool-detail-card table th { width: 130px; }
}

@media (max-width: 420px) {
  .topbar-location { max-width: 170px; }.topbar-location strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dashboard-hero { padding: 23px 17px; border-radius: 18px; }.hero-copy h1 { font-size: 34px; }.hero-copy > p:last-child { font-size: 13px; }
  .range-tabs { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .title-icon { width: 38px; height: 38px; margin-right: 6px; }
  .reorder-row { grid-template-columns: 36px minmax(0,1fr); }.reorder-weight { grid-column: 2; text-align: left; }.reorder-weight small { display: inline; margin-left: 5px; }
  .section-badge { display: none; }
  .spool-select-menu { left: 8px; right: 8px; }.spool-option { align-items: flex-start; }.spool-option-main { align-items: flex-start; }.spool-option .spool-select-weight { font-size: 11px; }
  .auth-panel { padding-inline: 17px; }.auth-card-head h1 { font-size: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
