/* ===========================================================================
   OMNIA — design system (light theme)
   Palette basata sullo stile del login: card bianche su sfondo grigio chiaro,
   accent #4a86e8. Le altre pagine caricano anche Tailwind CDN (vedi head.tpl):
   qui restano definiti i componenti condivisi (nav, card, table, modal, btn).
   =========================================================================== */

:root {
  --bg:            #e9ecef;
  --surface:       #ffffff;
  --surface-2:     #ffffff;
  --border:        #d1d5db;
  --border-soft:   #cccccc;
  --text:          #333333;
  --text-muted:    #555555;
  --text-dim:      #888888;
  --accent:        #4a86e8;
  --accent-hover:  #3a6ecc;
  --accent-soft:   #4a86e8;
  --danger:        #dc2626;
  --danger-hover:  #ef4444;
  --ok:            #22c55e;
  --ok-soft:       #16a34a;
  --radius:        8px;
  --radius-lg:     10px;
  --radius-xl:     14px;
  --font:          'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

h1, h2, h3, h4 { margin: 0; font-weight: 700; }

/* ------------------------------------------------------------ layout ----- */

.om-wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.om-page { padding: 24px; max-width: 1200px; margin: 0 auto; }

.om-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.om-toolbar h1 { font-size: 1.5rem; color: #333; }
.om-toolbar__actions { display: flex; gap: 8px; align-items: center; }

/* ------------------------------------------------------- top nav bar ----- */

.nav { background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.nav__bar {
  max-width: 1200px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 18px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.1rem; color: var(--text);
}
.brand__mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 14px -4px rgba(74,134,232,0.5);
}
.brand__mark::after { content: "O."; color: #fff; font-weight: 900; font-size: 14px; line-height: 1; }
.nav__spacer { flex: 1; }
.nav__menu { display: flex; align-items: center; gap: 6px; }
.nav__link {
  padding: 8px 14px; border-radius: 8px;
  color: var(--text-muted); font-size: 0.9rem; font-weight: 600;
  transition: background-color .15s, color .15s;
}
.nav__link:hover { background: #f1f5f9; color: var(--text); }
.nav__link.is-active { background: var(--accent); color: #fff; }
.nav__toggle { display: none; background: none; border: none; color: var(--text); font-size: 22px; cursor: pointer; }
.nav__user { display: flex; align-items: center; gap: 14px; margin-left: 8px; }
.nav__who { display: flex; flex-direction: column; line-height: 1.1; }
.nav__who small { color: var(--text-dim); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.nav__who span { font-size: 0.85rem; font-weight: 600; }

.lang-switch { display: inline-flex; gap: 2px; }
.lang-switch__opt { padding: 4px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; color: var(--text-dim); }
.lang-switch__opt.is-active { background: var(--accent); color: #fff; }

/* --------------------------------------------------------- buttons ------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 5px; border: 1px solid transparent;
  background: #eef1f5; color: var(--text);
  font-family: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer;
  transition: background-color .2s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn--primary, .btn.btn-primary {
  background: var(--accent); color: #fff;
}
.btn--primary:hover, .btn.btn-primary:hover { background: var(--accent-hover); }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text-muted); }
.btn--ghost:hover { border-color: var(--border-soft); color: var(--text); }
.btn--block { width: 100%; }
.btn--sm { padding: 6px 12px; font-size: 0.8rem; }
.btn--lg { padding: 13px 26px; font-size: 1rem; }
.btn--amber { background: var(--accent); color: #fff; }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: var(--danger-hover); }

.btn-icon { border: none; background: none; cursor: pointer; font-size: 15px; padding: 4px 6px; color: var(--text-muted); border-radius: 6px; }
.btn-icon:hover { background: #f1f5f9; color: var(--text); }
.btn-icon.btn-danger { color: var(--danger); }

/* ----------------------------------------------------------- cards ------- */

.om-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.om-card--form { padding: 22px; margin-bottom: 20px; }
.om-card--form h2 { margin: 0 0 14px; font-size: 1rem; color: var(--text); }
.om-card--muted { color: var(--text-muted); }
.om-card__label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); margin-bottom: 6px; }
.om-card__value { font-size: 24px; font-weight: 800; color: var(--text); }
.om-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin: 16px 0 24px; }

/* ---------------------------------------------------------- tables ------- */

.om-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.om-table thead { background: #f8fafc; color: var(--text-muted); text-transform: uppercase; font-size: 11px; letter-spacing: .05em; }
.om-table th, .om-table td { padding: 12px 14px; border-bottom: 1px solid #eef0f3; font-size: 0.85rem; text-align: left; }
.om-table tbody tr:hover { background: #f8fafc; }
.om-table .text-right { text-align: right; }
.om-table .text-center { text-align: center; }

.om-sub { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.om-green { color: var(--ok-soft); font-weight: 600; }

.om-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; background: #eff6ff; color: var(--accent); font-size: 11px; font-weight: 600; }
.om-badge--ok  { background: #dcfce7; color: #166534; }
.om-badge--off { background: #fee2e2; color: #991b1b; }

/* ---------------------------------------------------------- forms -------- */

.om-filters { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
input, select, textarea { font-family: inherit; }
.om-filters input, .om-filters select,
.om-grid input, .om-grid select,
.om-cell, .input {
  background: #fff; border: 1px solid var(--border-soft); border-radius: 5px;
  color: var(--text); padding: 8px 10px; font-size: 0.85rem;
}
.om-filters input:focus, .om-grid input:focus, .om-grid select:focus, .om-cell:focus, .input:focus {
  outline: none; border-color: var(--accent);
}
input::placeholder, textarea::placeholder { color: var(--text-dim); }

.om-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.om-grid label { display: flex; flex-direction: column; font-size: 12px; color: var(--text-muted); gap: 4px; }
.om-grid input, .om-grid select { width: 100%; }

hr { border: none; border-top: 1px solid #eef0f3; margin: 16px 0; }

/* --------------------------------------------------------- modals -------- */

.om-modal { position: fixed; inset: 0; background: rgba(15,23,42,0.5); display: flex; align-items: center; justify-content: center; z-index: 999; }
.om-modal[hidden] { display: none; }
.om-modal__box { background: var(--surface); border-radius: var(--radius-lg); padding: 24px; width: min(640px, 92vw); max-height: 88vh; overflow-y: auto; box-shadow: 0 20px 40px -12px rgba(0,0,0,0.25); }
.om-modal__box h2 { margin: 0 0 16px; font-size: 1.15rem; }
.om-modal__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* --------------------------------------------------- auth / login -------- */
/* Fedele allo stile del login fornito: card bianca centrata, ombra morbida. */

.auth {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: var(--bg);
}
.auth > div { width: 100%; max-width: 350px; }
.auth__card {
  background: #fff;
  padding: 40px;
  border-radius: 10px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.1);
  text-align: center;
}
.auth__brand { text-align: center; margin-bottom: 22px; }
.auth__brand .brand__mark { width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 12px; }
.auth__brand .brand__mark::after { font-size: 24px; }
.auth__brand-name { font-size: 1.4rem; font-weight: 800; color: #333; letter-spacing: .04em; }
.auth__brand-sub { color: var(--accent); font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; margin-top: 2px; }
.auth__card h1 { color: #333; margin: 0 0 30px; font-size: 1.4rem; }
.auth .field { margin-bottom: 20px; text-align: left; }
.auth .field label { display: block; font-size: 14px; font-weight: bold; margin-bottom: 5px; color: #555; }
.auth .input { width: 100%; padding: 12px; border: 1px solid #ccc; border-radius: 5px; font-size: 14px; }
.auth .input:focus { border-color: var(--accent); outline: none; }
.auth .btn--block { padding: 12px; border-radius: 5px; font-size: 16px; }
.auth__check { display: flex; align-items: center; gap: .5rem; font-size: 14px; color: #555; margin-bottom: 20px; }
.auth__check input { width: auto; }
.auth__extra { margin-top: 15px; padding-top: 15px; border-top: 1px solid #eee; }
.auth__extra a { font-size: 14px; text-decoration: underline; }
.auth .msg { margin-top: 15px; font-size: 14px; font-weight: bold; min-height: 20px; }

/* --------------------------------------------------------- toast --------- */

.toast { position: fixed; top: 1.25rem; left: 50%; transform: translateX(-50%); z-index: 600; padding: 12px 20px; border-radius: 8px; font-size: 0.9rem; font-weight: 600; box-shadow: 0 12px 24px -6px rgba(0,0,0,0.2); }
.toast--success { background: var(--ok); color: #fff; }
.toast--error   { background: var(--danger); color: #fff; }
.toast--info    { background: var(--accent); color: #fff; }
.toast__dot { display: none; }
.toast__x { background: none; border: none; color: inherit; font-size: 18px; cursor: pointer; margin-left: 8px; opacity: .8; }

/* --------------------------------------------------------- misc ---------- */

.om-quicklinks { display: flex; gap: 10px; }
.om-check { flex-direction: row !important; align-items: center; gap: 8px !important; }
.om-check input { width: auto; }
.om-inline-add { display: flex; gap: 8px; margin: 12px 0; align-items: center; }

.site-footer { border-top: 1px solid var(--border); margin-top: 40px; }
.site-footer__in { max-width: 1200px; margin: 0 auto; padding: 18px 20px; color: var(--text-dim); font-size: 12px; }
.page-auth .site-footer { display: none; }

.error-page { min-height: 70vh; display: flex; align-items: center; justify-content: center; text-align: center; }
.error-404 { font-size: 6rem; font-weight: 900; color: var(--accent); letter-spacing: -0.05em; }
.error-404 span { color: var(--accent-hover); }
.error-page__msg { margin: 1rem 0 1.5rem; color: var(--text-muted); }

/* --------------------------------------------------------- responsive ---- */

@media (max-width: 720px) {
  .nav__toggle { display: block; }
  .nav__menu {
    display: none; position: absolute; top: 56px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; background: var(--surface);
    border-bottom: 1px solid var(--border); padding: 10px; gap: 4px; z-index: 500;
  }
  .nav__menu.is-open { display: flex; }
  .om-grid { grid-template-columns: 1fr; }
}
