/* =========================================================================
   VOLANTINI OMNILINK · Enterprise UI v2
   Design system con sidebar nav, tipografia Inter, palette neutra raffinata.
   ========================================================================= */

@import url('https://rsms.me/inter/inter.css');

/* ---------- Design tokens ---------- */
:root {
  /* Surface (neutri, base zinc) */
  --c-bg:        #f7f8fa;
  --c-surface:   #ffffff;
  --c-surface-2: #f1f3f6;
  --c-border:    #e3e6eb;
  --c-border-2:  #d1d5db;

  /* Text */
  --c-text:      #0f172a;     /* slate-900 */
  --c-text-2:    #475569;     /* slate-600 */
  --c-text-3:    #94a3b8;     /* slate-400 */

  /* Accent (premium indigo / blu enterprise) */
  --c-primary:        #4f46e5;  /* indigo-600 */
  --c-primary-2:      #4338ca;  /* indigo-700 */
  --c-primary-soft:   #eef2ff;  /* indigo-50 */
  --c-primary-text:   #312e81;  /* indigo-900 */

  /* Semantic */
  --c-success:      #10b981;
  --c-success-bg:   #ecfdf5;
  --c-warning:      #f59e0b;
  --c-warning-bg:   #fffbeb;
  --c-danger:       #ef4444;
  --c-danger-bg:    #fef2f2;
  --c-info:         #3b82f6;
  --c-info-bg:      #eff6ff;

  /* Brand secondario (resta come accento per richiami "promo") */
  --c-brand:        #e11d48;  /* rose-600 → meglio rispetto a un rosso saturo */

  /* Spacing scale */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-7: 32px; --s-8: 40px; --s-10: 64px;

  /* Radius */
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px; --r-full: 999px;

  /* Elevation (soft shadows) */
  --sh-1: 0 1px 2px 0 rgb(15 23 42 / 0.04), 0 1px 3px 0 rgb(15 23 42 / 0.06);
  --sh-2: 0 4px 6px -1px rgb(15 23 42 / 0.06), 0 2px 4px -2px rgb(15 23 42 / 0.04);
  --sh-3: 0 10px 15px -3px rgb(15 23 42 / 0.08), 0 4px 6px -4px rgb(15 23 42 / 0.06);
  --sh-lg: 0 20px 25px -5px rgb(15 23 42 / 0.1), 0 8px 10px -6px rgb(15 23 42 / 0.08);

  /* Typography */
  --font-sans: 'Inter var', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;

  /* Layout */
  --sidebar-w: 240px;
  --topbar-h: 60px;
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { font-feature-settings: 'cv11', 'ss01', 'ss03'; }
body {
  font-family: var(--font-sans);
  background: var(--c-bg);
  color: var(--c-text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: var(--c-primary); text-decoration: none; transition: color .15s; }
a:hover { color: var(--c-primary-2); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }

h1, h2, h3, h4 { letter-spacing: -0.02em; color: var(--c-text); margin-top: 0; }
h1 { font-size: 26px; font-weight: 700; margin: 0 0 var(--s-2); line-height: 1.2; }
h2 { font-size: 19px; font-weight: 600; margin: var(--s-7) 0 var(--s-3); }
h3 { font-size: 15px; font-weight: 600; margin: var(--s-5) 0 var(--s-2); }

code { font-family: var(--font-mono); font-size: 0.85em; background: var(--c-surface-2); padding: 2px 6px; border-radius: 4px; color: var(--c-primary-text); }
.muted { color: var(--c-text-2); }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- Layout ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: #cbd5e1;
  padding: var(--s-5) var(--s-3) var(--s-3);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #1e293b;
}
.sidebar .logo {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 0 var(--s-3) var(--s-6);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: var(--s-4);
  text-decoration: none;
  color: #fff;
}
.sidebar .logo-mark {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--c-primary) 0%, #818cf8 100%);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 17px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}
.sidebar .logo-name { font-weight: 700; font-size: 15px; color: #f1f5f9; line-height: 1.1; }
.sidebar .logo-sub  { font-size: 11px; color: #64748b; letter-spacing: 0.5px; text-transform: uppercase; }

.sidebar nav { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.sidebar .nav-section {
  font-size: 10.5px; color: #64748b;
  text-transform: uppercase; letter-spacing: 1px;
  font-weight: 600; padding: var(--s-4) var(--s-3) var(--s-2); margin-top: var(--s-2);
}
.sidebar .nav-link {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 9px var(--s-3);
  color: #cbd5e1;
  border-radius: var(--r-md);
  font-weight: 500; font-size: 13.5px;
  text-decoration: none;
  transition: all .15s;
}
.sidebar .nav-link:hover { background: rgba(255,255,255,0.05); color: #fff; text-decoration: none; }
.sidebar .nav-link.active {
  background: rgba(79, 70, 229, 0.18);
  color: #fff;
  box-shadow: inset 2px 0 0 var(--c-primary);
}
.sidebar .nav-link svg { width: 17px; height: 17px; opacity: .9; flex-shrink: 0; }

.sidebar .nav-cta {
  margin: var(--s-3) 0;
  padding: 11px var(--s-3);
  background: var(--c-primary);
  color: #fff;
  border-radius: var(--r-md);
  font-weight: 600; font-size: 13.5px;
  text-align: center;
  display: flex; align-items: center; justify-content: center; gap: var(--s-2);
  transition: background .15s;
}
.sidebar .nav-cta:hover { background: var(--c-primary-2); color: #fff; text-decoration: none; }

.sidebar .user-card {
  margin-top: auto;
  padding: var(--s-3);
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--r-md);
  display: flex; align-items: center; gap: var(--s-3);
}
.sidebar .user-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff;
  flex-shrink: 0;
}
.sidebar .user-info { flex: 1; min-width: 0; }
.sidebar .user-name { color: #f1f5f9; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .user-role { color: #64748b; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.sidebar .user-logout { color: #94a3b8; padding: 6px; border-radius: var(--r-sm); transition: all .15s; }
.sidebar .user-logout:hover { background: rgba(239, 68, 68, 0.15); color: #fca5a5; text-decoration: none; }

/* ---------- Main content area ---------- */
.main-content {
  padding: var(--s-7) var(--s-8);
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s-4);
  margin-bottom: var(--s-6);
}
.page-header h1 { margin: 0; }
.page-header .subtitle { color: var(--c-text-2); margin: 4px 0 0; font-size: 14px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 8px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
  line-height: 1.2;
  white-space: nowrap;
}
.btn:hover { background: var(--c-surface-2); border-color: var(--c-border-2); text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; }

.btn-primary {
  background: var(--c-primary);
  color: #fff;
  border-color: var(--c-primary);
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.2);
}
.btn-primary:hover { background: var(--c-primary-2); border-color: var(--c-primary-2); color: #fff; }

.btn-danger { color: var(--c-danger); border-color: #fecaca; background: #fff; }
.btn-danger:hover { background: var(--c-danger-bg); }

.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--c-surface-2); }

.btn-lg { padding: 11px 20px; font-size: 14.5px; font-weight: 600; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ---------- Forms ---------- */
.form fieldset {
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-6) var(--s-7);
  margin: 0 0 var(--s-5);
  background: var(--c-surface);
  box-shadow: var(--sh-1);
}
.form legend {
  font-weight: 600; color: var(--c-text);
  padding: 0 var(--s-3);
  font-size: 13px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.form label {
  display: block;
  margin: var(--s-4) 0;
  font-weight: 500;
  font-size: 13px;
  color: var(--c-text);
}
.form input[type=text],
.form input[type=email],
.form input[type=password],
.form input[type=date],
.form input[type=number],
.form input[type=file],
.form select,
.form textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 8px 12px;
  border: 1px solid var(--c-border-2);
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-family: inherit;
  background: var(--c-surface);
  color: var(--c-text);
  transition: border-color .15s, box-shadow .15s;
}
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}
.form input[type=color] {
  width: 50px; height: 36px; padding: 3px;
  border: 1px solid var(--c-border-2); border-radius: var(--r-md);
  margin-top: 6px; cursor: pointer; background: #fff;
}
.form input[type=file] { padding: 7px 10px; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
.form small { font-weight: normal; color: var(--c-text-2); display: block; margin-top: 4px; font-size: 12px; }
.form-actions {
  display: flex; gap: var(--s-3); justify-content: flex-end;
  padding-top: var(--s-4); border-top: 1px solid var(--c-border); margin-top: var(--s-5);
}

/* ---------- Layout picker ---------- */
.layout-picker {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--s-3); margin-top: var(--s-3);
}
.layout-option { margin: 0; cursor: pointer; }
.layout-option input { display: none; }
.layout-card {
  display: block;
  border: 2px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-3);
  text-align: center;
  background: var(--c-surface);
  transition: all .2s;
}
.layout-option:hover .layout-card { border-color: var(--c-border-2); transform: translateY(-1px); }
.layout-option input:checked + .layout-card {
  border-color: var(--c-primary);
  background: var(--c-primary-soft);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}
.layout-card strong { display: block; margin-top: var(--s-2); font-size: 13px; color: var(--c-text); }
.layout-card small { display: block; color: var(--c-text-2); font-size: 11.5px; margin-top: 3px; }

.layout-thumb {
  display: block; width: 100%; height: 80px;
  background-color: #f3f4f6;
  border-radius: var(--r-sm);
  position: relative; overflow: hidden;
  background-image: linear-gradient(to right, var(--c-brand) 0, var(--c-brand) 100%);
  background-repeat: no-repeat;
  background-position: top;
  background-size: 100% 14px;
}
.layout-thumb::after {
  content: ''; position: absolute; left: 6px; right: 6px; top: 20px; bottom: 6px;
}
.layout-thumb-classic_3x3::after, .layout-thumb-bold_color::after {
  background-image:
    linear-gradient(#cbd5e1,#cbd5e1), linear-gradient(#cbd5e1,#cbd5e1), linear-gradient(#cbd5e1,#cbd5e1),
    linear-gradient(#cbd5e1,#cbd5e1), linear-gradient(#cbd5e1,#cbd5e1), linear-gradient(#cbd5e1,#cbd5e1),
    linear-gradient(#cbd5e1,#cbd5e1), linear-gradient(#cbd5e1,#cbd5e1), linear-gradient(#cbd5e1,#cbd5e1);
  background-size: 30% 30%;
  background-position: 0% 0%, 50% 0%, 100% 0%, 0% 50%, 50% 50%, 100% 50%, 0% 100%, 50% 100%, 100% 100%;
  background-repeat: no-repeat;
}
.layout-thumb-bold_color { background-color: var(--c-brand); }
.layout-thumb-bold_color::after {
  background-image:
    linear-gradient(#fff,#fff), linear-gradient(#fff,#fff), linear-gradient(#fff,#fff),
    linear-gradient(#fff,#fff), linear-gradient(#fff,#fff), linear-gradient(#fff,#fff),
    linear-gradient(#fff,#fff), linear-gradient(#fff,#fff), linear-gradient(#fff,#fff);
}
.layout-thumb-compact_4x3::after {
  background-image:
    linear-gradient(#cbd5e1,#cbd5e1), linear-gradient(#cbd5e1,#cbd5e1), linear-gradient(#cbd5e1,#cbd5e1),
    linear-gradient(#cbd5e1,#cbd5e1), linear-gradient(#cbd5e1,#cbd5e1), linear-gradient(#cbd5e1,#cbd5e1),
    linear-gradient(#cbd5e1,#cbd5e1), linear-gradient(#cbd5e1,#cbd5e1), linear-gradient(#cbd5e1,#cbd5e1),
    linear-gradient(#cbd5e1,#cbd5e1), linear-gradient(#cbd5e1,#cbd5e1), linear-gradient(#cbd5e1,#cbd5e1);
  background-size: 30% 22%;
  background-position: 0% 0%, 50% 0%, 100% 0%, 0% 33%, 50% 33%, 100% 33%, 0% 66%, 50% 66%, 100% 66%, 0% 100%, 50% 100%, 100% 100%;
  background-repeat: no-repeat;
}
.layout-thumb-minimal_2x2::after {
  background-image:
    linear-gradient(#cbd5e1,#cbd5e1), linear-gradient(#cbd5e1,#cbd5e1),
    linear-gradient(#cbd5e1,#cbd5e1), linear-gradient(#cbd5e1,#cbd5e1);
  background-size: 45% 45%;
  background-position: 0% 0%, 100% 0%, 0% 100%, 100% 100%;
  background-repeat: no-repeat;
}

/* ---------- Tables ---------- */
.data {
  width: 100%; border-collapse: collapse;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin: var(--s-4) 0;
  box-shadow: var(--sh-1);
}
.data th, .data td {
  padding: 12px var(--s-4);
  text-align: left;
  border-bottom: 1px solid var(--c-border);
  font-size: 13.5px;
  vertical-align: middle;
}
.data th {
  background: var(--c-surface-2);
  font-weight: 600; color: var(--c-text-2);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.data tr:last-child td { border-bottom: none; }
.data tr:hover td { background: rgba(79, 70, 229, 0.025); }
.data .num { text-align: right; font-variant-numeric: tabular-nums; }
.data .actions { text-align: right; white-space: nowrap; }
.data .actions .btn { margin-left: 4px; }

.prodotti-table input[type=text] {
  padding: 5px 8px; font-size: 13px; margin: 0; width: 100%;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--r-sm);
  transition: all .15s;
}
.prodotti-table input[type=text]:hover { border-color: var(--c-border); background: var(--c-surface); }
.prodotti-table input[type=text]:focus { border-color: var(--c-primary); background: var(--c-surface); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12); }
.prodotti-table input.small { max-width: 90px; }
.prodotti-table input.xs { max-width: 55px; }

.thumb {
  width: 44px; height: 44px;
  object-fit: contain;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  display: block;
}
.thumb-empty {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--c-surface-2); color: var(--c-text-3); font-weight: bold;
}

/* ---------- Empty state ---------- */
.empty-state {
  background: var(--c-surface);
  border: 2px dashed var(--c-border-2);
  border-radius: var(--r-xl);
  padding: var(--s-10) var(--s-7);
  text-align: center;
  margin: var(--s-6) 0;
}
.empty-state .empty-icon {
  width: 56px; height: 56px;
  background: var(--c-primary-soft);
  border-radius: var(--r-xl);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: var(--s-4);
}
.empty-state .empty-icon svg { width: 28px; height: 28px; color: var(--c-primary); }
.empty-state h2 { color: var(--c-text); margin: 0 0 var(--s-2); }
.empty-state p { color: var(--c-text-2); margin: 0 0 var(--s-5); max-width: 420px; margin-left: auto; margin-right: auto; }

/* ---------- Flash messages ---------- */
.flash {
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  margin: 0 0 var(--s-4);
  border: 1px solid;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-size: 13.5px;
  font-weight: 500;
}
.flash::before { font-size: 16px; }
.flash-success { background: var(--c-success-bg); border-color: #a7f3d0; color: #065f46; }
.flash-success::before { content: '✓'; color: var(--c-success); font-weight: bold; }
.flash-error   { background: var(--c-danger-bg);  border-color: #fca5a5; color: #991b1b; }
.flash-error::before { content: '!'; color: var(--c-danger); font-weight: bold; }
.flash-info    { background: var(--c-info-bg);    border-color: #93c5fd; color: #1e40af; }
.flash-info::before { content: 'i'; color: var(--c-info); font-style: italic; font-weight: bold; }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex; gap: var(--s-3); align-items: center;
  margin: var(--s-4) 0;
  padding: var(--s-3) var(--s-4);
  background: var(--c-surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--c-border);
  box-shadow: var(--sh-1);
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--c-border);
  margin: var(--s-6) 0 0;
}
.tab {
  background: none; border: none;
  padding: 10px var(--s-4);
  font-size: 13.5px; font-weight: 500;
  color: var(--c-text-2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
  transition: color .15s;
}
.tab:hover { color: var(--c-text); }
.tab.active { color: var(--c-primary); border-bottom-color: var(--c-primary); font-weight: 600; }
.tab-pane { display: none; padding-top: var(--s-5); }
.tab-pane.active { display: block; }

/* ---------- Stat cards ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--s-4);
  margin: var(--s-5) 0;
}
.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  box-shadow: var(--sh-1);
  transition: box-shadow .2s;
}
.stat-card:hover { box-shadow: var(--sh-2); }
.stat-card .stat-icon {
  width: 36px; height: 36px;
  background: var(--c-primary-soft);
  color: var(--c-primary);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--s-3);
}
.stat-card .stat-icon svg { width: 18px; height: 18px; }
.stat-num { font-size: 28px; font-weight: 700; color: var(--c-text); line-height: 1; font-variant-numeric: tabular-nums; }
.stat-lbl { font-size: 12px; color: var(--c-text-2); margin-top: 6px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 500; }

/* ---------- Login page ---------- */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--c-bg);
}
.login-side {
  background: linear-gradient(135deg, #312e81 0%, #4f46e5 50%, #6366f1 100%);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--s-8);
  color: #fff;
}
.login-side::before {
  content: '';
  position: absolute;
  top: -50%; right: -50%;
  width: 100%; height: 100%;
  background: radial-gradient(circle, rgba(255,255,255,0.08), transparent 60%);
}
.login-side .brand-block { position: relative; z-index: 1; display: flex; align-items: center; gap: var(--s-3); }
.login-side .brand-mark {
  width: 44px; height: 44px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 19px;
  backdrop-filter: blur(10px);
}
.login-side h2 { font-size: 36px; font-weight: 700; line-height: 1.15; color: #fff; margin: 0 0 var(--s-3); position: relative; }
.login-side p { font-size: 16px; opacity: 0.85; max-width: 420px; margin: 0; position: relative; }
.login-side .features { position: relative; display: flex; flex-direction: column; gap: var(--s-3); }
.login-side .feature { display: flex; align-items: center; gap: var(--s-3); font-size: 14px; opacity: 0.9; }
.login-side .feature svg { width: 18px; height: 18px; opacity: 0.7; }
.login-side .copyright { position: relative; font-size: 12px; opacity: 0.5; }

.login-form-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: var(--s-7);
}
.login-box {
  background: var(--c-surface);
  padding: var(--s-8);
  border-radius: var(--r-xl);
  width: 400px; max-width: 100%;
  box-shadow: var(--sh-3);
  border: 1px solid var(--c-border);
}
.login-box h1 { font-size: 22px; margin: 0 0 var(--s-2); font-weight: 700; }
.login-box .login-subtitle { color: var(--c-text-2); margin: 0 0 var(--s-7); font-size: 14px; }

/* ---------- Misc ---------- */
.user-card-mobile { display: none; }
.drag-handle { user-select: none; transition: color .15s; }
.drag-handle:hover { color: var(--c-text-2) !important; }
tr.sort-ghost { opacity: .35; background: var(--c-warning-bg) !important; }

dialog::backdrop { background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(4px); }
dialog {
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  padding: var(--s-7);
  box-shadow: var(--sh-lg);
  background: var(--c-surface);
}
dialog .form { padding: 0; margin: 0; }
dialog .form fieldset { border: none; padding: 0; box-shadow: none; }
dialog h2 { margin-top: 0; font-size: 18px; }

.badge-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: 11px; font-weight: 600;
  background: var(--c-surface-2);
  color: var(--c-text-2);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-success { background: var(--c-success-bg); color: #065f46; }
.badge-warning { background: var(--c-warning-bg); color: #92400e; }
.badge-danger  { background: var(--c-danger-bg);  color: #991b1b; }
.badge-info    { background: var(--c-info-bg);    color: #1e40af; }
.badge-primary { background: var(--c-primary-soft); color: var(--c-primary-text); }

.status-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: var(--r-full);
  background: var(--c-text-3); margin-right: 6px; vertical-align: middle;
}
.status-active { background: var(--c-success); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18); }
.status-warn   { background: var(--c-warning); }
.status-danger { background: var(--c-danger); }

.bottombar {
  padding: var(--s-7) 0 var(--s-5);
  text-align: center;
  color: var(--c-text-3);
  font-size: 12px;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: -260px; top: 0;
    z-index: 100; transition: left .25s;
    width: 260px;
  }
  .sidebar.open { left: 0; }
  .main-content { padding: var(--s-5) var(--s-4); }
  .login-shell { grid-template-columns: 1fr; }
  .login-side { display: none; }
  .form .row { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; align-items: stretch; }
}
.mobile-menu-btn {
  display: none;
  position: fixed; top: var(--s-3); left: var(--s-3); z-index: 101;
  width: 38px; height: 38px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  cursor: pointer;
  align-items: center; justify-content: center;
  box-shadow: var(--sh-2);
}
@media (max-width: 900px) { .mobile-menu-btn { display: flex; } }

/* ============================================================
   DARK MODE — variabili override su [data-theme="dark"]
   ============================================================ */
[data-theme="dark"] {
  --c-bg:        #0b1018;
  --c-surface:   #131a26;
  --c-surface-2: #1a2230;
  --c-border:    #25304a;
  --c-border-2:  #364257;

  --c-text:      #e2e8f0;
  --c-text-2:    #94a3b8;
  --c-text-3:    #64748b;

  --c-primary-soft: rgba(79, 70, 229, 0.18);
  --c-primary-text: #c7d2fe;

  --c-success-bg:   rgba(16, 185, 129, 0.12);
  --c-warning-bg:   rgba(245, 158, 11, 0.12);
  --c-danger-bg:    rgba(239, 68, 68, 0.12);
  --c-info-bg:      rgba(59, 130, 246, 0.12);

  --sh-1: 0 1px 2px 0 rgb(0 0 0 / 0.4), 0 1px 3px 0 rgb(0 0 0 / 0.3);
  --sh-2: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.4);
  --sh-3: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.4);
  --sh-lg: 0 20px 25px -5px rgb(0 0 0 / 0.6), 0 8px 10px -6px rgb(0 0 0 / 0.5);
}

[data-theme="dark"] .sidebar {
  background: linear-gradient(180deg, #060912 0%, #0d1322 100%);
  border-right-color: #1a2230;
}

[data-theme="dark"] .data tr:hover td { background: rgba(79, 70, 229, 0.06); }
[data-theme="dark"] .login-side { background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%); }
[data-theme="dark"] .stat-card:hover { box-shadow: var(--sh-2); }
[data-theme="dark"] code { background: #1a2230; color: #c7d2fe; }
[data-theme="dark"] .layout-card { background: #131a26; }
[data-theme="dark"] .layout-option input:checked + .layout-card {
  background: rgba(79, 70, 229, 0.1);
}
[data-theme="dark"] .form input,
[data-theme="dark"] .form select,
[data-theme="dark"] .form textarea {
  background: #131a26;
  color: var(--c-text);
  border-color: var(--c-border-2);
}
[data-theme="dark"] .btn { background: #1a2230; color: var(--c-text); border-color: var(--c-border-2); }
[data-theme="dark"] .btn:hover { background: #25304a; }
[data-theme="dark"] .btn-primary { color: #fff; }
[data-theme="dark"] .btn-danger { background: rgba(239, 68, 68, 0.08); border-color: rgba(239, 68, 68, 0.4); }

/* Toggle button */
.theme-toggle {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: #cbd5e1;
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: var(--s-3);
  transition: background .15s;
  font-family: inherit;
}
.theme-toggle:hover { background: rgba(255,255,255,0.1); color: #fff; }
.theme-toggle svg { width: 14px; height: 14px; }

/* Smooth transition theme switch */
html { transition: background-color .25s ease; }
body, .sidebar, .data, .stat-card, .form fieldset, .toolbar, dialog, .login-box {
  transition: background-color .25s ease, border-color .25s ease, color .25s ease;
}

/* ============================================================
   BREADCRUMB
   ============================================================ */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--c-text-3);
  margin-bottom: var(--s-3);
  font-weight: 500;
}
.breadcrumb a { color: var(--c-text-2); text-decoration: none; }
.breadcrumb a:hover { color: var(--c-primary); text-decoration: none; }
.breadcrumb .sep {
  opacity: 0.5;
  display: inline-block;
}
.breadcrumb .current { color: var(--c-text); font-weight: 500; }

/* ============================================================
   PDF PREVIEW (iframe nella pagina dettaglio)
   ============================================================ */
.pdf-preview {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin: var(--s-4) 0;
  position: relative;
}
.pdf-preview iframe {
  display: block;
  width: 100%;
  height: 700px;
  border: 0;
  background: #525659;
}
.pdf-preview-header {
  padding: var(--s-3) var(--s-4);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.pdf-preview-header strong { color: var(--c-text); }
.pdf-preview-actions { display: flex; gap: 8px; }

/* Two-column layout per dettaglio */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: var(--s-5);
  margin-top: var(--s-4);
}
@media (max-width: 1100px) {
  .detail-grid { grid-template-columns: 1fr; }
}
.detail-side {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}
.info-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-4) var(--s-5);
  box-shadow: var(--sh-1);
}
.info-card h3 {
  margin: 0 0 var(--s-3);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--c-text-2);
  font-weight: 600;
}
.info-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--c-border);
}
.info-row:last-child { border-bottom: 0; }
.info-row .lbl { color: var(--c-text-2); }
.info-row .val { color: var(--c-text); font-weight: 500; }

.action-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.action-list .btn { justify-content: flex-start; padding: 10px 14px; }

.color-swatch {
  display: inline-block;
  width: 14px; height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.1);
  vertical-align: middle;
  margin-right: 4px;
}

/* Thumbnails per i nuovi layout */
.layout-thumb-magazine_2x3::after {
  background-image:
    linear-gradient(#9ca3af, #9ca3af), linear-gradient(#cbd5e1,#cbd5e1),
    linear-gradient(#9ca3af, #9ca3af), linear-gradient(#cbd5e1,#cbd5e1),
    linear-gradient(#9ca3af, #9ca3af), linear-gradient(#cbd5e1,#cbd5e1),
    linear-gradient(#9ca3af, #9ca3af), linear-gradient(#cbd5e1,#cbd5e1),
    linear-gradient(#9ca3af, #9ca3af), linear-gradient(#cbd5e1,#cbd5e1),
    linear-gradient(#9ca3af, #9ca3af), linear-gradient(#cbd5e1,#cbd5e1);
  background-size: 22% 30%, 22% 30%, 22% 30%, 22% 30%, 22% 30%, 22% 30%, 22% 30%, 22% 30%, 22% 30%, 22% 30%, 22% 30%, 22% 30%;
  background-position:
    0% 0%, 28% 0%, 50% 0%, 78% 0%,
    0% 50%, 28% 50%, 50% 50%, 78% 50%,
    0% 100%, 28% 100%, 50% 100%, 78% 100%;
  background-repeat: no-repeat;
}
.layout-thumb-gallery_2x4::after {
  background-image:
    linear-gradient(#9ca3af,#9ca3af), linear-gradient(#9ca3af,#9ca3af),
    linear-gradient(#9ca3af,#9ca3af), linear-gradient(#9ca3af,#9ca3af),
    linear-gradient(#9ca3af,#9ca3af), linear-gradient(#9ca3af,#9ca3af),
    linear-gradient(#9ca3af,#9ca3af), linear-gradient(#9ca3af,#9ca3af);
  background-size: 45% 22%;
  background-position: 0% 0%, 100% 0%, 0% 33%, 100% 33%, 0% 66%, 100% 66%, 0% 100%, 100% 100%;
  background-repeat: no-repeat;
}
.layout-thumb-dark_premium { background-color: #0f172a; }
.layout-thumb-dark_premium::after {
  background-image:
    linear-gradient(#d4af37,#d4af37), linear-gradient(#d4af37,#d4af37), linear-gradient(#d4af37,#d4af37),
    linear-gradient(#d4af37,#d4af37), linear-gradient(#d4af37,#d4af37), linear-gradient(#d4af37,#d4af37);
  background-size: 30% 45%;
  background-position: 0% 0%, 50% 0%, 100% 0%, 0% 100%, 50% 100%, 100% 100%;
  background-repeat: no-repeat;
  opacity: 0.6;
}

/* ============================================================
   PALETTE PICKER (preset colori)
   ============================================================ */
.palette-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--s-3);
  margin-top: var(--s-3);
}
.palette-option {
  background: var(--c-surface);
  border: 2px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--s-3);
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  transition: all .15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
}
.palette-option:hover {
  border-color: var(--c-border-2);
  transform: translateY(-1px);
  box-shadow: var(--sh-1);
}
.palette-option.selected {
  border-color: var(--c-primary);
  background: var(--c-primary-soft);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}
.palette-swatches {
  display: flex;
  gap: 4px;
  margin-bottom: 2px;
}
.palette-swatches .sw {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(0,0,0,0.1);
  display: block;
}
.palette-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--c-text);
  text-align: center;
}
[data-theme="dark"] .palette-option { background: #131a26; }
[data-theme="dark"] .palette-option.selected { background: rgba(79, 70, 229, 0.15); }
