/* ── AMR Premium CRM — Brand Book Palette ─────────────────────────── */
:root {
  --amr-slate:   #323D41;
  --amr-gold:    #C9A84C;
  --amr-gray:    #595959;
  --amr-white:   #FCFCFA;
  --amr-red:     #CD212A;
  --amr-row-alt: #ECEEF0;

  --sidebar-width: 260px;
}

/* ── Reset / base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  font-size: 0.9rem;
  color: var(--amr-gray);
  background: var(--amr-white);
}

h1, h2, h3, h4 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  color: var(--amr-slate);
  font-weight: 600;
}

a { color: var(--amr-gold); text-decoration: none; }
a:hover { color: var(--amr-slate); text-decoration: underline; }

/* ── Layout wrapper ────────────────────────────────────────────────── */
.amr-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ───────────────────────────────────────────────────────── */
.amr-sidebar {
  width: var(--sidebar-width);
  background: var(--amr-slate);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.amr-sidebar-brand {
  padding: 2rem 1.25rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  text-align: center;
}
.amr-sidebar-brand img { width: 140px; max-width: 100%; height: auto; }
.amr-sidebar-brand .brand-name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1rem;
  color: var(--amr-gold);
  display: block;
  margin-top: 0.5rem;
  line-height: 1.2;
}

.amr-nav { list-style: none; margin: 0; padding: 0.75rem 0; flex: 1; }
.amr-nav-section {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  padding: 1rem 1.25rem 0.25rem;
}
.amr-nav li a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1.25rem;
  color: rgba(255,255,255,0.82);
  font-size: 0.875rem;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}
.amr-nav li a:hover,
.amr-nav li a.active {
  background: rgba(201,168,76,0.12);
  color: var(--amr-gold);
  border-left-color: var(--amr-gold);
  text-decoration: none;
}
.amr-nav li a i { width: 18px; text-align: center; opacity: 0.75; }
.amr-nav li a.active i { opacity: 1; }

.amr-sidebar-user {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.8rem;
  color: rgba(255,255,255,0.6);
}
.amr-sidebar-user strong { color: #fff; display: block; }

/* ── Main content ─────────────────────────────────────────────────── */
.amr-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.amr-topbar {
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.amr-topbar-title { font-size: 1rem; font-weight: 600; color: var(--amr-slate); }

.amr-content { padding: 1.75rem 1.5rem; flex: 1; background: #f0f2f3; }

/* ── Notifiche campanellino ───────────────────────────────────────── */
.amr-bell-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--amr-slate);
  font-size: 1.1rem;
  padding: 0.25rem;
}
.amr-bell-badge {
  position: absolute;
  top: -4px; right: -6px;
  background: var(--amr-red);
  color: #fff;
  border-radius: 50%;
  font-size: 0.6rem;
  min-width: 16px;
  height: 16px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

/* ── Card ──────────────────────────────────────────────────────────── */
.amr-card {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.amr-card-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.15rem;
  color: var(--amr-slate);
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--amr-gold);
  display: inline-block;
}

/* ── KPI tile ─────────────────────────────────────────────────────── */
.amr-kpi {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-top: 3px solid var(--amr-gold);
  border-radius: 4px;
  padding: 1.25rem;
  text-align: center;
}
.amr-kpi-value {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--amr-slate);
  line-height: 1;
}
.amr-kpi-label {
  font-size: 0.75rem;
  color: var(--amr-gray);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.35rem;
}

/* ── Bottoni ───────────────────────────────────────────────────────── */
.btn-amr-primary {
  background: var(--amr-gold);
  color: #fff;
  border: none;
  border-radius: 3px;
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-amr-primary:hover { background: #b8923e; color: #fff; }

.btn-amr-secondary {
  background: transparent;
  color: var(--amr-slate);
  border: 1px solid var(--amr-slate);
  border-radius: 3px;
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-amr-secondary:hover { background: var(--amr-slate); color: #fff; }

/* ── Alert banner ──────────────────────────────────────────────────── */
.amr-alert {
  border-left: 4px solid var(--amr-gold);
  background: #fffbf0;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border-radius: 0 3px 3px 0;
  font-size: 0.875rem;
}
.amr-alert.danger  { border-left-color: var(--amr-red);  background: #fff5f5; }
.amr-alert.success { border-left-color: #28a745; background: #f0fff4; }
.amr-alert.info    { border-left-color: #17a2b8; background: #f0faff; }

/* ── Tabelle ───────────────────────────────────────────────────────── */
.amr-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.amr-table a { color: var(--amr-slate); font-weight: 600; }
.amr-table a:hover { color: var(--amr-gold); text-decoration: underline; }
.amr-table th {
  background: var(--amr-slate);
  color: #fff;
  padding: 0.6rem 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}
.amr-table td { padding: 0.6rem 0.75rem; border-bottom: 1px solid #d4d8da; color: #2d2d2d; }
.amr-table tr:nth-child(even) td { background: var(--amr-row-alt); }
.amr-table tr:hover td { background: #e8e2d0; }

/* ── Badge stato ───────────────────────────────────────────────────── */
.badge-stato {
  display: inline-block;
  padding: 0.2em 0.6em;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.stato-disponibile    { background: #e8f5e9; color: #2e7d32; }
.stato-in_trattativa  { background: #fff8e1; color: #f57f17; }
.stato-prenotata      { background: #fff3e0; color: #e65100; }
.stato-compromessa    { background: #fce4ec; color: #c62828; }
.stato-venduta        { background: #eceff1; color: #546e7a; }
.stato-sospesa        { background: #f5f5f5; color: #9e9e9e; }

/* ── Form ──────────────────────────────────────────────────────────── */
.amr-form-group { margin-bottom: 1rem; }
.amr-form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--amr-slate);
  margin-bottom: 0.25rem;
}
.amr-form-group input,
.amr-form-group select,
.amr-form-group textarea {
  width: 100%;
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 0.45rem 0.65rem;
  font-size: 0.875rem;
  color: var(--amr-gray);
  transition: border-color 0.15s;
}
.amr-form-group input:focus,
.amr-form-group select:focus,
.amr-form-group textarea:focus {
  outline: none;
  border-color: var(--amr-gold);
  box-shadow: 0 0 0 2px rgba(201,168,76,0.2);
}
.amr-form-group .helper { font-size: 0.75rem; color: #888; margin-top: 0.2rem; }

/* ── Login page ────────────────────────────────────────────────────── */
.amr-login-page {
  min-height: 100vh;
  background: var(--amr-slate);
  display: flex;
  align-items: center;
  justify-content: center;
}
.amr-login-box {
  background: #fff;
  border-radius: 4px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}
.amr-login-box .login-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}
.amr-login-box .login-logo img { max-height: 60px; }
.amr-login-box .login-title {
  text-align: center;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.4rem;
  color: var(--amr-slate);
  margin: 0 0 1.5rem;
}
.amr-login-box .login-subtitle {
  text-align: center;
  font-size: 0.8rem;
  color: #888;
  margin-top: -1rem;
  margin-bottom: 1.5rem;
}

/* ── Card header/body (variante strutturata) ───────────────────────── */
.amr-card { padding: 0; }
.amr-card-header {
  padding: 0.75rem 1rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--amr-slate);
  border-bottom: 2px solid var(--amr-gold);
  background: #fafaf8;
}
.amr-card-body { padding: 1rem; }

/* ── KPI row e tile ────────────────────────────────────────────────── */
.amr-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}
.amr-kpi-tile {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-top: 3px solid var(--amr-gold);
  border-radius: 4px;
  padding: 1rem;
  text-align: center;
}
.amr-kpi-tile.kpi-warning { border-top-color: #f0ad4e; }
.amr-kpi-tile.kpi-alert   { border-top-color: var(--amr-red); }
.kpi-value {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--amr-slate);
  line-height: 1;
}
.kpi-label {
  font-size: 0.72rem;
  color: var(--amr-gray);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.3rem;
}

/* ── Page header ───────────────────────────────────────────────────── */
.amr-page-header { margin-bottom: 1.5rem; }
.amr-page-header h1 { margin: 0; }

/* ── Form control (classe diretta su input/select/textarea) ────────── */
.amr-form-control {
  width: 100%;
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 0.45rem 0.65rem;
  font-size: 0.875rem;
  color: var(--amr-gray);
  transition: border-color 0.15s;
}
.amr-form-control:focus {
  outline: none;
  border-color: var(--amr-gold);
  box-shadow: 0 0 0 2px rgba(201,168,76,0.2);
}

/* ── Definition list ───────────────────────────────────────────────── */
.amr-dl { display: grid; grid-template-columns: 160px 1fr; gap: 0.35rem 0.75rem; margin: 0; font-size: 0.85rem; }
.amr-dl dt { color: #888; font-weight: 600; font-size: 0.78rem; align-self: start; padding-top: 0.1rem; }
.amr-dl dd { margin: 0; color: var(--amr-slate); word-break: break-word; }

/* ── Badge stato — classi dirette (senza prefisso .stato-) ────────── */
.badge-stato.disponibile  { background: #e8f5e9; color: #2e7d32; }
.badge-stato.prenotata    { background: #fff3e0; color: #e65100; }
.badge-stato.compromessa  { background: #fce4ec; color: #c62828; }
.badge-stato.venduta      { background: #eceff1; color: #546e7a; }
.badge-stato.attiva       { background: #e8f5e9; color: #2e7d32; }
.badge-stato.sospesa      { background: #fff8e1; color: #856404; }
.badge-stato.terminata    { background: #f5f5f5; color: #9e9e9e; }
.badge-stato.in_trattativa { background: #fff8e1; color: #f57f17; }

/* ── Mobile ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .amr-sidebar { transform: translateX(-100%); transition: transform 0.25s; }
  .amr-sidebar.open { transform: translateX(0); }
  .amr-main { margin-left: 0; }
  .amr-content { padding: 1rem; }
  .amr-kpi-row { grid-template-columns: 1fr 1fr; }
  .amr-dl { grid-template-columns: 1fr; }
}
