/* ==========================================================
   AtelierDesk – Stylesheet v1.2.0
   Modern, clean, professional UI in German
   ========================================================== */

:root {
  --primary:       #2C5F5D;
  --primary-dark:  #1e4341;
  --primary-light: #e8f0ef;
  --accent:        #4A8F8C;
  --text:          #1a1a2e;
  --text-muted:    #6b7280;
  --text-light:    #9ca3af;
  --bg:            #f8f9fa;
  --bg-card:       #ffffff;
  --border:        #e5e7eb;
  --border-dark:   #d1d5db;
  --sidebar-bg:    #2C5F5D;
  --sidebar-text:  #ffffff;
  --sidebar-w:     240px;
  --sidebar-collapsed-w: 56px;
  --radius:        8px;
  --radius-sm:     4px;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:     0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
  --transition:    0.15s ease;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: var(--text); background: var(--bg); line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; }
ul, ol { list-style: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* ==========================================================
   LAYOUT
   ========================================================== */

.app-layout {
  display: flex;
  min-height: 100vh;
  min-height: calc(100vh - 36px);
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(175deg, var(--primary-dark) 0%, var(--primary) 55%, var(--accent) 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  color: var(--sidebar-text);
  border-bottom: 1px solid color-mix(in srgb, var(--sidebar-text), transparent 85%);
}
.sidebar-brand--logo {
  justify-content: center;
  padding: 16px 12px;
}
.sidebar-brand span { font-size: 1.1rem; font-weight: 600; letter-spacing: -0.3px; }

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  color: color-mix(in srgb, var(--sidebar-text), transparent 28%);
  font-size: 0.88rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item:hover { background: color-mix(in srgb, var(--sidebar-text), transparent 88%); color: var(--sidebar-text); }
.nav-item.active { background: color-mix(in srgb, var(--sidebar-text), transparent 80%); color: var(--sidebar-text); }

.nav-divider { height: 1px; background: color-mix(in srgb, var(--sidebar-text), transparent 88%); margin: 8px 4px; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 12px;
  border-top: 1px solid color-mix(in srgb, var(--sidebar-text), transparent 85%);
}
.user-info { flex: 1; min-width: 0; }
.user-name { display: block; color: var(--sidebar-text); font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { display: block; color: color-mix(in srgb, var(--sidebar-text), transparent 42%); font-size: 0.75rem; }
.btn-logout { display: flex; align-items: center; padding: 6px; border-radius: var(--radius-sm); color: color-mix(in srgb, var(--sidebar-text), transparent 42%); transition: color var(--transition); background: none; border: none; cursor: pointer; }
.btn-logout svg { width: 17px; height: 17px; }
.btn-logout:hover { color: var(--sidebar-text); }

/* Sidebar collapse toggle */
.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 8px 0;
  background: none;
  border: none;
  border-top: 1px solid color-mix(in srgb, var(--sidebar-text), transparent 85%);
  cursor: pointer;
  color: color-mix(in srgb, var(--sidebar-text), transparent 50%);
  transition: color var(--transition);
}
.sidebar-toggle:hover { color: var(--sidebar-text); }
.sidebar-toggle svg { width: 16px; height: 16px; transition: transform 0.2s ease; }

/* Sidebar + main transitions */
.sidebar       { transition: width 0.2s ease; }
.main-content  { transition: margin-left 0.2s ease; }
.app-footer    { transition: margin-left 0.2s ease; }

/* Collapsed state */
html.sidebar-collapsed .sidebar             { width: var(--sidebar-collapsed-w); overflow: hidden; }
html.sidebar-collapsed .main-content        { margin-left: var(--sidebar-collapsed-w); }
html.sidebar-collapsed .app-footer          { margin-left: var(--sidebar-collapsed-w); }
html.sidebar-collapsed .nav-label           { display: none; }
html.sidebar-collapsed .sidebar-brand span  { display: none; }
html.sidebar-collapsed .sidebar-brand img,
html.sidebar-collapsed .sidebar-brand > svg { visibility: hidden; }
html.sidebar-collapsed .sidebar-brand       { justify-content: center; padding: 16px 0; }
html.sidebar-collapsed .nav-item            { justify-content: center; padding: 10px 0; position: relative; }
html.sidebar-collapsed .nav-item:hover::after {
  content: attr(data-label);
  position: absolute;
  left: calc(var(--sidebar-collapsed-w) - 4px);
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,.82);
  color: #fff;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  z-index: 200;
  pointer-events: none;
}
html.sidebar-collapsed .user-info           { display: none; }
html.sidebar-collapsed .sidebar-user        { justify-content: center; flex-wrap: wrap; gap: 4px; padding: 10px 4px; }
html.sidebar-collapsed .sidebar-toggle svg  { transform: rotate(180deg); }

/* Main content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
}
.content-inner {
  flex: 1;
  padding: 28px 32px;
  width: 100%;
  box-sizing: border-box;
}

/* Todo list */
.todo-list { list-style: none; margin: 0; padding: 0; }
.todo-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
}
.todo-item:last-child { border-bottom: none; }
.todo-item.todo-overdue { background: rgba(220,38,38,.05); }
.todo-item.todo-done { opacity: .55; }
.todo-check {
  flex-shrink: 0; margin-top: 1px; background: none; border: none;
  cursor: pointer; padding: 0; color: var(--text-muted); line-height: 1;
}
.todo-check svg { width: 20px; height: 20px; display: block; }
.todo-check:hover { color: var(--primary); }
.todo-check--done { color: var(--success); }
.todo-check--done:hover { color: var(--text-muted); }
.todo-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.todo-title { font-size: 0.9rem; font-weight: 500; color: var(--text); }
.todo-done .todo-title { text-decoration: line-through; }
.todo-desc { font-size: 0.8rem; color: var(--text-muted); }
.todo-due { font-size: 0.75rem; color: var(--text-muted); }
.todo-due--late { color: var(--danger); }
.todo-link { font-size: 0.75rem; color: var(--text-muted); }
.autocomplete-list {
  display: none; position: absolute; top: 100%; left: 0; right: 0;
  background: var(--bg-card); border: 1px solid var(--border-dark);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  list-style: none; margin: 0; padding: 0;
  z-index: 200; max-height: 220px; overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
}
.todo-delete {
  flex-shrink: 0; background: none; border: none; cursor: pointer;
  padding: 2px; color: var(--text-muted); opacity: 0; transition: opacity var(--transition), color var(--transition);
}
.todo-delete svg { width: 15px; height: 15px; display: block; }
.todo-item:hover .todo-delete { opacity: 1; }
.todo-delete:hover { color: var(--danger); }

/* Footer */
.app-footer {
  margin-left: var(--sidebar-w);
  padding: 8px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.app-footer a { color: var(--text-muted); }
.app-footer a:hover { color: var(--primary); }

/* ==========================================================
   PAGE HEADER
   ========================================================== */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}
.page-header .subtitle {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 2px;
}
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: var(--border-dark); }
.breadcrumb .current { color: var(--text); }

/* ==========================================================
   CARDS
   ========================================================== */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 1rem; font-weight: 600; color: var(--text); }
.card-body { }
.card-sm { padding: 16px; }

/* Stats cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.stat-card .stat-label { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; color: var(--text); line-height: 1; }
.stat-card .stat-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }
.stat-card.accent { border-left: 3px solid var(--primary); }

/* ==========================================================
   TABLES
   ========================================================== */

.table-wrapper { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  background: var(--bg);
}
.table td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:hover td { background: var(--bg); }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr.row-overdue td { background: rgba(220,38,38,.06); }
.table tbody tr.row-overdue:hover td { background: rgba(220,38,38,.1); }
.table .actions { white-space: nowrap; text-align: right; vertical-align: middle !important; }
.table .actions > a, .table .actions > button, .table .actions > form { display: inline-flex; align-items: center; }
.table .actions > form { vertical-align: middle; }
.table .text-right { text-align: right; }
.table .nowrap { white-space: nowrap; }

/* ==========================================================
   FORMS
   ========================================================== */

.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row .col-3 { grid-column: span 1; }
.form-row .col-1 { grid-column: span 1; max-width: 120px; }

label {
  display: block;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
}
label small { font-weight: 400; color: var(--text-muted); }

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text);
  background: white;
  transition: border-color var(--transition), box-shadow var(--transition);
  line-height: 1.5;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(44,95,93,0.12);
}
.form-control::placeholder { color: var(--text-light); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control {
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 34px;
}

.form-check { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.form-check input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); }
.form-check label { margin-bottom: 0; font-weight: 400; cursor: pointer; }

.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }
.form-section { padding-top: 20px; margin-top: 20px; border-top: 1px solid var(--border); }
.form-section-title { font-size: 0.88rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 16px; }

/* ==========================================================
   BUTTONS
   ========================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.87rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}
.btn svg { width: 15px; height: 15px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: white; }

.btn-secondary { background: white; color: var(--text); border-color: var(--border-dark); }
.btn-secondary:hover { background: var(--bg); color: var(--text); }

.btn-danger { background: #dc2626; color: white; border-color: #dc2626; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: white; }

.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; padding: 6px 10px; }
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-lg { padding: 11px 22px; font-size: 0.95rem; }
.btn-block { width: 100%; justify-content: center; }

/* ==========================================================
   BADGES
   ========================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-blue    { background: #dbeafe; color: #1d4ed8; }
.badge-indigo  { background: #e0e7ff; color: #4338ca; }
.badge-orange  { background: #ffedd5; color: #c2410c; }
.badge-purple  { background: #ede9fe; color: #7c3aed; }
.badge-green   { background: #dcfce7; color: #16a34a; }
.badge-gray    { background: #f3f4f6; color: #4b5563; }
.badge-red     { background: #fee2e2; color: #dc2626; }
.badge-teal    { background: var(--primary-light); color: var(--primary-dark); }

/* ==========================================================
   ALERTS
   ========================================================== */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert ul { margin: 4px 0 0 16px; }
.alert-success { background: #f0fdf4; color: #16a34a; border-color: #bbf7d0; }
.alert-error   { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert-info    { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }

/* ==========================================================
   ACTIVITY TIMELINE
   ========================================================== */

.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 10px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-dot {
  position: absolute;
  left: -24px;
  top: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
}
.timeline-dot.type-system    { border-color: #6b7280; }
.timeline-dot.type-notiz     { border-color: #2563eb; }
.timeline-dot.type-kontakt   { border-color: #7c3aed; }
.timeline-dot.type-anprobe   { border-color: #db2777; }
.timeline-dot.type-aenderung { border-color: var(--primary); }
.timeline-dot.type-status    { border-color: #d97706; }
.timeline-dot.type-zahlung   { border-color: #16a34a; }

.timeline-content { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.timeline-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.timeline-type { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.timeline-user { font-size: 0.78rem; color: var(--text-muted); }
.timeline-date { font-size: 0.75rem; color: var(--text-light); margin-left: auto; }
.timeline-text { font-size: 0.88rem; color: var(--text); white-space: pre-line; }

/* ==========================================================
   FILTERS & SEARCH
   ========================================================== */

.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.filter-bar .form-group { margin-bottom: 0; }
.filter-bar .form-control { min-width: 160px; }
.search-input-wrapper { position: relative; }
.search-input-wrapper svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); pointer-events: none; }
.search-input { padding-left: 34px !important; }

/* ==========================================================
   UTILS
   ========================================================== */

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-mono { font-family: 'Courier New', monospace; }
.font-bold { font-weight: 600; }
.small { font-size: 0.82rem; }
.section-title { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin: 20px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state p { margin-bottom: 16px; }
/* Settings Tabs */
.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
}
.tab-btn {
  padding: 10px 22px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition);
  font-family: inherit;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 900px) { .settings-grid { grid-template-columns: 1fr; } }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.detail-item { }
.detail-label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 2px; }
.detail-value { font-size: 0.92rem; color: var(--text); }
.highlight-box { background: var(--primary-light); border: 1px solid var(--primary); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 16px; }

/* Modal */
.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1000; align-items: center; justify-content: center; }
.modal-backdrop.open { display: flex; }
.modal { background: white; border-radius: var(--radius); padding: 24px; width: 100%; max-width: 480px; box-shadow: var(--shadow-md); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-title { font-size: 1rem; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 1.3rem; color: var(--text-muted); cursor: pointer; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ==========================================================
   INSTALL & AUTH PAGES
   ========================================================== */

.install-body, .auth-body { background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }

.install-wrapper {
  max-width: 680px;
  margin: 40px auto;
  padding: 0 20px;
  width: 100%;
  flex: 1;
}
.install-logo { text-align: center; margin-bottom: 28px; }
.install-logo svg { display: block; margin: 0 auto 12px; }
.install-logo h1 { font-size: 1.6rem; font-weight: 700; color: var(--text); }
.install-logo p { color: var(--text-muted); font-size: 0.9rem; }
.install-card { background: white; border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; margin-bottom: 20px; box-shadow: var(--shadow); }
.install-card h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: 8px; }
.install-footer { text-align: center; font-size: 0.78rem; color: var(--text-muted); padding: 16px; display: flex; justify-content: space-between; }
.install-footer a { color: var(--text-muted); }
.install-checklist { margin: 20px 0; display: flex; flex-direction: column; gap: 12px; }
.install-check-item { display: flex; align-items: flex-start; gap: 12px; }
.check-icon { width: 22px; height: 22px; background: #dcfce7; color: #16a34a; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; flex-shrink: 0; margin-top: 2px; }
.install-success-icon { font-size: 3rem; margin-bottom: 16px; }

.auth-wrapper { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-card { background: white; border: 1px solid var(--border); border-radius: var(--radius); padding: 36px; width: 100%; max-width: 420px; box-shadow: var(--shadow-md); }
.auth-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.auth-logo h1 { font-size: 1.3rem; font-weight: 700; }
.auth-logo p { color: var(--text-muted); font-size: 0.85rem; }
.auth-logo-custom { max-height: 56px; max-width: 180px; object-fit: contain; display: block; }
.sidebar-logo-img { object-fit: contain; display: block; }
.auth-footer { margin-top: 20px; font-size: 0.75rem; color: var(--text-muted); display: flex; gap: 16px; }
.auth-footer a { color: var(--text-muted); }

/* ── New split auth layout ── */
.auth-body { background: var(--bg); min-height: 100vh; margin: 0; padding: 0; }
.auth-split { display: flex; min-height: 100vh; }

.auth-panel-left {
  width: 420px; flex-shrink: 0;
  background: linear-gradient(155deg, var(--primary-dark) 0%, var(--primary) 50%, var(--accent) 100%);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 52px 44px 32px;
  color: white;
}
.auth-panel-inner { flex: 1; }
.auth-brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; margin-bottom: 28px; }
.auth-brand-logo { max-width: 100%; object-fit: contain; display: block; }
.auth-brand-icon { width: 56px; height: 56px; background: rgba(255,255,255,.18); border-radius: 14px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.auth-brand-name { font-size: 1.5rem; font-weight: 700; letter-spacing: -.3px; line-height: 1.2; }
.auth-tagline { font-size: 0.92rem; opacity: .75; margin-bottom: 36px; }
.auth-panel-inner { flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; }
.auth-features { display: flex; flex-direction: column; gap: 12px; width: 100%; text-align: left; }
.auth-feature { font-size: 0.88rem; opacity: .85; display: flex; gap: 10px; }
.auth-feature span { opacity: .6; font-weight: 700; }
.auth-panel-footer { font-size: 0.72rem; opacity: .5; }
.auth-panel-footer a { color: white; }

.auth-panel-right {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
  background: var(--bg);
}
.auth-form-wrap { width: 100%; max-width: 400px; }

@media (max-width: 700px) {
  .auth-split { flex-direction: column; }
  .auth-panel-left { width: 100%; padding: 32px 28px 28px; }
  .auth-features { display: none; }
  .auth-tagline { margin-bottom: 0; }
  .auth-panel-footer { display: none; }
}

/* ==========================================================
   FILE UPLOAD
   ========================================================== */

.drop-zone {
  border: 2px dashed var(--border-dark);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg);
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--primary); background: var(--primary-light); }
.drop-zone .drop-icon { font-size: 2rem; margin-bottom: 8px; }
.file-list { margin-top: 12px; }
.file-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 6px; }
.file-item .file-name { flex: 1; font-size: 0.87rem; word-break: break-all; }
.file-item .file-size { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }
.file-thumb { width: 36px; height: 36px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); }

/* ==========================================================
   PRINT STYLES
   ========================================================== */

@media print {
  .sidebar, .app-footer, .page-actions, .btn, .filter-bar, .no-print { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .content-inner { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; }
  body { background: white; }
}

/* ==========================================================
   RESPONSIVE
   ========================================================== */

/* Dashboard scrollable boxes */
.db-widget {
  display: flex !important;
  flex-direction: column;
  height: 400px;
}
.db-widget .card-header { flex-shrink: 0; }
.db-scroll-box {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-dark) transparent;
}
.db-scroll-box::-webkit-scrollbar { width: 5px; }
.db-scroll-box::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 3px; }

/* Hamburger button (mobile only) */
.hamburger-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1100;
  background: var(--primary);
  color: var(--sidebar-text);
  border: none;
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.hamburger-btn svg { width: 20px; height: 20px; }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1050;
}
.sidebar-overlay.active { display: block; }

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-240px); transition: transform 0.25s ease; width: 240px; z-index: 1060; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding-top: 56px; }
  .app-footer { margin-left: 0; }
  .form-row { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .three-col { grid-template-columns: 1fr 1fr; }
  .content-inner { padding: 16px; }
  .sidebar-toggle { display: none; }
  html.sidebar-collapsed .main-content { margin-left: 0; }
  html.sidebar-collapsed .app-footer   { margin-left: 0; }
  .hamburger-btn { display: flex; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ==========================================================
   LABEL PRINT (Brother DK)
   ========================================================== */

.label-preview {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: white;
  display: inline-block;
}

@page label {
  size: 62mm auto;
  margin: 0;
}

.label-print-area {
  width: 62mm;
  min-height: 40mm;
  background: white;
  padding: 4mm 5mm;
  font-family: 'Arial', sans-serif;
  color: black;
  box-sizing: border-box;
}

.label-order-number {
  font-size: 22pt;
  font-weight: 900;
  letter-spacing: -0.5px;
  line-height: 1;
  margin-bottom: 2mm;
}

.label-customer { font-size: 11pt; font-weight: 700; margin-bottom: 1mm; }
.label-garment { font-size: 9pt; margin-bottom: 2mm; color: #333; }
.label-divider { border-top: 1px solid black; margin: 2mm 0; }
.label-row { display: flex; justify-content: space-between; font-size: 8pt; margin-bottom: 1mm; }
.label-status { font-size: 9pt; font-weight: 700; }
.label-qr { text-align: right; margin-top: 2mm; }

@media print {
  body.label-print * { visibility: hidden; }
  body.label-print .label-print-area,
  body.label-print .label-print-area * { visibility: visible; }
  body.label-print .label-print-area { position: fixed; left: 0; top: 0; }
}

/* ==========================================================
   ADDITIONAL UTILITIES
   ========================================================== */

.text-danger { color: #dc2626 !important; }
.text-success { color: #16a34a !important; }
.text-warning { color: #d97706 !important; }
.fw-bold { font-weight: 700; }
.d-flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }

/* Form row 3-col and 1-col overrides */
.form-row.col-3-1 { grid-template-columns: 3fr 1fr; }
.form-row.col-2-1 { grid-template-columns: 2fr 1fr; }
.form-row.col-1-2 { grid-template-columns: 1fr 2fr; }

/* Mobile menu toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    cursor: pointer;
    font-size: 1.1rem;
}
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
}
.mobile-overlay.open { display: block; }

@media (max-width: 768px) {
    .mobile-menu-toggle { display: flex; align-items: center; justify-content: center; }
    .content-inner { padding-top: 56px; }
}

/* Pagination */
.pagination { display: flex; gap: 4px; margin-top: 16px; }
.page-link { padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.82rem; color: var(--text); }
.page-link:hover { background: var(--bg); }
.page-link.active { background: var(--primary); color: white; border-color: var(--primary); }
.page-link.disabled { color: var(--text-light); pointer-events: none; }

/* Tooltip */
[title] { cursor: help; }

/* Code */
code { font-family: 'Courier New', monospace; background: var(--bg); padding: 1px 5px; border-radius: 3px; font-size: 0.85em; border: 1px solid var(--border); }

/* Horizontal Rule */
hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ==========================================================
   Tabs */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 20px; gap: 0; }
.tab-btn { padding: 10px 18px; font-size: 0.87rem; font-weight: 500; color: var(--text-muted); border: none; background: none; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all var(--transition); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-btn:hover:not(.active) { color: var(--text); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ==========================================================
   DARK MODE
   ========================================================== */

[data-theme="dark"] {
  --primary:       #5ba3a0;
  --primary-dark:  #4A8F8C;
  --primary-light: #1a2e2d;
  --accent:        #6db4b1;
  --text:          #e8e8e8;
  --text-muted:    #a0a0a0;
  --text-light:    #686868;
  --bg:            #1e1e1e;
  --bg-card:       #282828;
  --border:        #383838;
  --border-dark:   #484848;
}

[data-theme="dark"] body { background: var(--bg); color: var(--text); }

[data-theme="dark"] .card { box-shadow: none; border-color: var(--border); }

[data-theme="dark"] .form-control {
  background: #323232;
  color: var(--text);
  border-color: var(--border-dark);
}
[data-theme="dark"] .form-control::placeholder { color: var(--text-light); }
[data-theme="dark"] .form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91,163,160,0.15); }

[data-theme="dark"] .btn-secondary { background: #363636; color: var(--text); border-color: var(--border-dark); }
[data-theme="dark"] .btn-secondary:hover { background: #424242; }
[data-theme="dark"] .btn-ghost:hover { background: #323232; color: var(--text); }

[data-theme="dark"] .modal { background: var(--bg-card); }
[data-theme="dark"] .auth-card, [data-theme="dark"] .install-card { background: var(--bg-card); border-color: var(--border); }

[data-theme="dark"] .table th { background: #242424; color: var(--text-muted); }
[data-theme="dark"] .table tbody tr:hover td { background: #323232; }

[data-theme="dark"] .badge-gray   { background: #363636; color: #c8c8c8; }
[data-theme="dark"] .badge-blue   { background: #1e3048; color: #93c5fd; }
[data-theme="dark"] .badge-green  { background: #1a3020; color: #86efac; }
[data-theme="dark"] .badge-red    { background: #3a1818; color: #fca5a5; }
[data-theme="dark"] .badge-orange { background: #3a2010; color: #fdba74; }
[data-theme="dark"] .badge-teal   { background: #1e3634; color: #5eead4; }
[data-theme="dark"] .badge-purple { background: #2e1e40; color: #c4b5fd; }
[data-theme="dark"] .badge-indigo { background: #22223a; color: #a5b4fc; }

[data-theme="dark"] .alert-success { background: #1a3020; color: #86efac; border-color: #2a5030; }
[data-theme="dark"] .alert-error   { background: #3a1818; color: #fca5a5; border-color: #602020; }
[data-theme="dark"] .alert-warning { background: #3a2010; color: #fdba74; border-color: #603010; }

[data-theme="dark"] code { background: #323232; border-color: var(--border-dark); }
[data-theme="dark"] .highlight-box { background: #1e3634; border-color: var(--primary); }
[data-theme="dark"] .timeline-content { background: #282828; }
[data-theme="dark"] .drop-zone { background: #282828; }
[data-theme="dark"] .drop-zone:hover, [data-theme="dark"] .drop-zone.dragover { background: #323232; }
[data-theme="dark"] .file-item { background: #282828; }
[data-theme="dark"] .page-header { border-color: var(--border); }
[data-theme="dark"] .filter-bar { background: var(--bg-card); border-color: var(--border); }
[data-theme="dark"] select option { background: #282828; }

#dark-mode-toggle .icon-sun              { display: none; }
#dark-mode-toggle .icon-moon             { display: block; }
[data-theme="dark"] #dark-mode-toggle .icon-moon  { display: none !important; }
[data-theme="dark"] #dark-mode-toggle .icon-sun   { display: block !important; }

/* Status select colors */
select.status-select option[value="neu"]            { background: #dbeafe; }
select.status-select option[value="in_arbeit"]      { background: #ffedd5; }
select.status-select option[value="fertig"]         { background: #dcfce7; }
select.status-select option[value="storniert"]      { background: #fee2e2; }
