/* ============================================
   ODONTIA — Design system (gestionale)
   Ported from Claude Design handoff (chat 2026-05-03)
   ============================================ */

:root {
  /* Brand */
  --brand-purple: #8B6FC9;
  --brand-blue:   #5B7BBF;
  --brand-teal:   #3FCFAF;
  --brand-dark:   #2a1f4a;
  --brand-gradient: linear-gradient(135deg, #8B6FC9 0%, #5B7BBF 50%, #3FCFAF 100%);
  --brand-gradient-soft: linear-gradient(135deg, rgba(139,111,201,0.08) 0%, rgba(91,123,191,0.08) 50%, rgba(63,207,175,0.08) 100%);

  --bs-primary: #5B7BBF;
  --bs-primary-rgb: 91,123,191;

  /* Semantic */
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger:  #ef4444;
  --color-info:    #3b82f6;
  --color-success-soft: #d1fae5;
  --color-warning-soft: #fef3c7;
  --color-danger-soft:  #fee2e2;
  --color-info-soft:    #e8f4fd;

  /* Surface */
  --surface-1: #ffffff;
  --surface-2: #f7f8fb;
  --surface-3: #eef2f9;
  --surface-4: #f0f5ff;
  --border:    #e7eaf1;
  --border-strong: #d8dde8;
  --text:      #1f2433;
  --text-muted:#6b7390;
  --text-soft: #98a0b8;

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

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

  /* Shadow */
  --shadow-xs: 0 1px 2px rgba(40,44,72,0.04);
  --shadow-sm: 0 1px 3px rgba(91,123,191,0.06), 0 1px 2px rgba(40,44,72,0.04);
  --shadow-md: 0 4px 14px rgba(91,123,191,0.10);
  --shadow-lg: 0 12px 40px rgba(91,123,191,0.15);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --t-fast: .15s ease;
  --t-base: .25s ease;
  --t-slow: .4s ease;
}

/* ====== Base reset within app shell ====== */
.od-app, .od-app * { box-sizing: border-box; }
.od-app {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--surface-2);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11','ss01','ss03';
  min-height: 100vh;
  display: flex;
}

.od-app h1,.od-app h2,.od-app h3,.od-app h4,.od-app h5 {
  margin: 0; color: var(--text); letter-spacing: -0.01em;
}

.od-app a { color: var(--brand-blue); text-decoration: none; }
.od-app a:hover { color: var(--brand-purple); }

/* ====== Atoms ====== */
.od-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 600; line-height: 1.4;
  white-space: nowrap;
}
.od-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.od-pill.purple { background: #ede9fe; color: #6d28d9; }
.od-pill.blue   { background: #e0eaff; color: #2752c4; }
.od-pill.teal   { background: #d1fae5; color: #065f46; }
.od-pill.amber  { background: #fef3c7; color: #92400e; }
.od-pill.red    { background: #fee2e2; color: #991b1b; }
.od-pill.gray   { background: #eef0f6; color: #475069; }

.od-icon-box {
  width: 40px; height: 40px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.od-icon-box.lg { width: 52px; height: 52px; border-radius: 12px; font-size: 22px; }
.od-icon-box.sm { width: 30px; height: 30px; border-radius: 8px; font-size: 14px; }

.od-info-label {
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-muted);
}

.od-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px;
  flex-shrink: 0; letter-spacing: -0.02em;
  text-transform: uppercase;
}
.od-avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.od-avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.od-avatar.xl { width: 96px; height: 96px; font-size: 28px; border: 3px solid #fff; box-shadow: var(--shadow-md); }
.od-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* ====== Buttons ====== */
.od-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 9px;
  font-family: inherit; font-size: 13px; font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer; transition: all var(--t-fast);
  white-space: nowrap; text-decoration: none;
}
.od-btn:hover { text-decoration: none; }
.od-btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.od-btn.lg { padding: 9px 18px; font-size: 14px; border-radius: 10px; }
.od-btn.icon { padding: 7px; }

.od-btn.primary {
  background: var(--brand-blue); color: #fff;
  box-shadow: 0 1px 2px rgba(91,123,191,0.25);
}
.od-btn.primary:hover { background: #4d6cad; color: #fff; }
.od-btn.gradient {
  background: var(--brand-gradient); color: #fff;
  box-shadow: 0 4px 14px rgba(91,123,191,0.25);
}
.od-btn.gradient:hover { color: #fff; opacity: 0.92; }
.od-btn.ghost { background: transparent; color: var(--text); }
.od-btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.od-btn.outline { background: #fff; color: var(--text); border-color: var(--border-strong); }
.od-btn.outline:hover { background: var(--surface-2); border-color: var(--brand-blue); color: var(--brand-blue); }
.od-btn.danger { background: var(--color-danger); color: #fff; }
.od-btn.danger:hover { background: #d93838; color: #fff; }
.od-btn.subtle { background: var(--surface-3); color: var(--text); }
.od-btn.subtle:hover { background: var(--surface-4); }

.od-btn-action {
  width: 30px; height: 30px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; font-size: 14px;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer; transition: all var(--t-fast);
  text-decoration: none;
}
.od-btn-action:hover { background: var(--surface-3); color: var(--text); border-color: var(--border-strong); text-decoration: none; }
.od-btn-action.primary { color: var(--brand-blue); }
.od-btn-action.primary:hover { color: var(--brand-blue); border-color: var(--brand-blue); background: #e9eefb; }
.od-btn-action.danger:hover  { color: var(--color-danger); border-color: var(--color-danger); background: #fee2e2; }

/* ====== Cards ====== */
.od-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.od-card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 600; font-size: 14px;
}
.od-card-body { padding: 18px; }

/* ====== Form ====== */
.od-input, .od-app .form-control, .od-app .form-select {
  width: 100%; padding: 8px 12px;
  background: #fff; border: 1px solid var(--border-strong);
  border-radius: 9px; font-family: inherit; font-size: 13px; color: var(--text);
  transition: all var(--t-fast); outline: none;
}
.od-input:focus, .od-app .form-control:focus, .od-app .form-select:focus {
  border-color: var(--brand-blue); box-shadow: 0 0 0 3px rgba(91,123,191,0.15);
}
.od-input::placeholder, .od-app .form-control::placeholder { color: var(--text-soft); }

.od-label {
  display: block; font-size: 12px; font-weight: 500;
  color: var(--text); margin-bottom: 5px;
}
.od-label .req { color: var(--color-danger); margin-left: 2px; }

.od-search {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--r-pill); padding: 6px 14px; min-width: 220px;
  transition: all var(--t-fast);
}
.od-search:focus-within { border-color: var(--brand-blue); box-shadow: 0 0 0 3px rgba(91,123,191,0.10); }
.od-search input { border: none; outline: none; flex: 1; font-size: 13px; background: transparent; font-family: inherit; color: var(--text); }
.od-search i { color: var(--text-soft); }

/* ====== Sidebar ====== */
.od-sidebar {
  width: 240px; min-height: 100vh;
  background: #fff; border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  flex-shrink: 0;
  position: sticky; top: 0; height: 100vh;
}
.od-sidebar .brand {
  padding: 18px 20px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}
.od-sidebar .brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--brand-gradient);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 14px;
  box-shadow: 0 4px 10px rgba(139,111,201,0.30);
}
.od-sidebar .brand-name {
  font-weight: 800; font-size: 15px; letter-spacing: 0.02em;
  background: var(--brand-gradient);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.od-sidebar nav { flex: 1; padding: 10px 10px; overflow: auto; }
.od-sidebar nav::-webkit-scrollbar { width: 4px; }
.od-sidebar nav::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

.od-sidebar .menu-title {
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--text-soft); padding: 14px 10px 6px;
}
.od-sidebar .menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 8px;
  color: #475069; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all var(--t-fast);
  position: relative; text-decoration: none;
  margin-bottom: 1px;
}
.od-sidebar .menu-item i { font-size: 17px; color: #6b7390; }
.od-sidebar .menu-item:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.od-sidebar .menu-item .count {
  margin-left: auto; background: var(--surface-3); color: var(--text-muted);
  font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px;
}
.od-sidebar .menu-item.active {
  background: rgba(91,123,191,0.10); color: var(--brand-blue);
}
.od-sidebar .menu-item.active i { color: var(--brand-blue); }
.od-sidebar .menu-item.active::before {
  content: ''; position: absolute; left: -10px; top: 6px; bottom: 6px; width: 3px;
  background: var(--brand-gradient); border-radius: 0 3px 3px 0;
}
.od-sidebar .menu-item.active .count {
  background: var(--brand-blue); color: #fff;
}

.od-sidebar .footer-user {
  padding: 12px 14px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}

/* ====== Topbar ====== */
.od-topbar {
  height: 60px; background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  flex-shrink: 0;
  position: sticky; top: 0; z-index: 100;
}

.od-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface-2);
}
.od-content {
  flex: 1;
  padding: 22px 26px;
}

/* ====== Page header ====== */
.od-page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 22px;
  flex-wrap: wrap;
}
.od-page-head .crumbs {
  font-size: 12px; color: var(--text-muted); margin-bottom: 4px;
  display: flex; align-items: center; gap: 6px;
}
.od-page-head .crumbs a { color: var(--text-muted); }
.od-page-head .crumbs a:hover { color: var(--brand-blue); }
.od-page-head h1 {
  font-size: 22px; font-weight: 700;
}
.od-page-head .subtitle { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.od-page-head .actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ====== Stat cards ====== */
.od-stat {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 16px;
  box-shadow: var(--shadow-xs);
  position: relative; overflow: hidden;
}
.od-stat .head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.od-stat .label {
  font-size: 11.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-muted);
}
.od-stat .value {
  font-size: 26px; font-weight: 700; line-height: 1.1;
  letter-spacing: -0.02em; color: var(--text);
}
.od-stat .delta { font-size: 12px; font-weight: 600; margin-top: 4px; display: inline-flex; align-items: center; gap: 4px; }
.od-stat .delta.up   { color: var(--color-success); }
.od-stat .delta.down { color: var(--color-danger); }

/* ====== Tables ====== */
.od-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.od-table thead th {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted);
  text-align: left; padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.od-table tbody td {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
  background: #fff;
}
.od-table tbody tr:hover td { background: var(--surface-4); }
.od-table tbody tr:last-child td { border-bottom: none; }

/* DataTables overrides when wrapped in .od-app */
.od-app .dataTables_wrapper .dataTables_filter { display: none; }
.od-app .dataTables_wrapper .dataTables_length { color: var(--text-muted); font-size: 12px; }
.od-app .dataTables_wrapper .dataTables_info { color: var(--text-muted); font-size: 12px; }
.od-app .dataTables_wrapper .dataTables_paginate .paginate_button {
  padding: 4px 10px; border-radius: 8px; font-size: 12px; border: 1px solid var(--border) !important;
  margin: 0 2px; background: #fff !important;
}
.od-app .dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--brand-blue) !important; color: #fff !important; border-color: var(--brand-blue) !important;
}
.od-app .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--surface-3) !important; color: var(--text) !important; border-color: var(--border-strong) !important;
}

/* ====== Tabs ====== */
.od-tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--border);
  margin-bottom: 16px; flex-wrap: wrap;
}
.od-tabs .tab {
  padding: 9px 14px; font-size: 13px; font-weight: 500;
  color: var(--text-muted); cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--t-fast);
  text-decoration: none;
}
.od-tabs .tab:hover { color: var(--text); }
.od-tabs .tab.active { color: var(--brand-blue); border-bottom-color: var(--brand-blue); }

/* ====== Empty state ====== */
.od-empty {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 40px 20px; gap: 12px;
}
.od-empty .illu {
  width: 140px; height: 140px;
  border-radius: 28px;
  background: var(--brand-gradient-soft);
  display: flex; align-items: center; justify-content: center;
  color: var(--brand-blue); font-size: 56px;
}
.od-empty h3 { font-size: 16px; font-weight: 700; }
.od-empty p { font-size: 13px; color: var(--text-muted); max-width: 320px; }

/* ====== Brand decorations ====== */
.od-grad-bar { background: var(--brand-gradient); height: 4px; width: 100%; }
.od-dot-grid {
  background-image: radial-gradient(rgba(91,123,191,0.18) 1px, transparent 1px);
  background-size: 16px 16px;
}

/* ====== Utils ====== */
.od-flex { display: flex; }
.od-row { display: flex; align-items: center; gap: 8px; }
.od-stack { display: flex; flex-direction: column; gap: 8px; }
.od-grow { flex: 1; }
.od-mono { font-family: var(--font-mono); }

/* ====== Bootstrap modal harmonization ====== */
.od-app .modal-content { border-radius: 16px; border: 1px solid var(--border); overflow: hidden; }
.od-app .modal-header { background: var(--brand-gradient); color: #fff; border-bottom: none; padding: 16px 20px; }
.od-app .modal-header .modal-title { font-weight: 700; font-size: 16px; }
.od-app .modal-header .btn-close { filter: invert(1) brightness(2); }
.od-app .modal-body { padding: 20px; }
.od-app .modal-footer { border-top: 1px solid var(--border); padding: 14px 20px; }

/* ====== Bootstrap badge harmonization (existing pages) ====== */
.od-app .badge.bg-primary { background: var(--brand-blue) !important; }

/* ====== Mobile ====== */
@media (max-width: 991px) {
  .od-sidebar { position: fixed; left: -240px; top: 0; transition: left var(--t-base); z-index: 200; }
  .od-sidebar.show { left: 0; box-shadow: 0 8px 30px rgba(0,0,0,0.2); }
  .od-content { padding: 16px; }
  .od-page-head { flex-direction: column; }
}
