:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #dbeafe;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --info: #0891b2;
  --info-soft: #cffafe;
  --sidebar: #0f172a;
  --sidebar-text: #cbd5e1;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 700; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; }
.hidden { display: none !important; }

/* ---------- Layout aplicație ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 1.1rem 1.25rem; font-size: 1.25rem; font-weight: 800; color: #fff; letter-spacing: -.02em; display: flex; align-items: center; gap: .5rem; }
.sidebar .brand span { background: var(--primary); color: #fff; border-radius: 8px; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; font-size: 1rem; }
.sidebar nav { flex: 1; padding: .5rem .75rem; }
.sidebar nav a {
  display: flex; align-items: center; gap: .65rem; padding: .6rem .75rem; border-radius: 8px;
  color: var(--sidebar-text); font-weight: 500; margin-bottom: 2px;
}
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.sidebar nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar nav .section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #64748b; padding: 1rem .75rem .35rem; }
.sidebar .user { padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,.08); font-size: .85rem; }
.sidebar .user strong { color: #fff; display: block; }
.sidebar .user form { display: inline; }
.sidebar .user button { background: none; border: 0; color: #94a3b8; cursor: pointer; padding: 0; font-size: .85rem; }
.sidebar .user button:hover { color: #fff; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.content { padding: 1.5rem 2rem 3rem; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.banner { padding: .65rem 2rem; font-size: .9rem; display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.banner.warning { background: var(--warning-soft); color: #92400e; }
.banner.info { background: var(--info-soft); color: #155e75; }
.banner a { font-weight: 600; }

/* ---------- Carduri și grid ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1.25rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 1rem; }
.grid > * { min-width: 0; } /* tabelele late nu lărgesc coloana de grid (mobil) */
.card { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; box-shadow: var(--shadow); }
.stat .label { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; }
.stat .hint { font-size: .8rem; color: var(--muted); }
.stat.accent { border-color: var(--primary); }

/* ---------- Tabele ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .6rem .6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: #f8fafc; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fafc; }
td.num, th.num { text-align: right; white-space: nowrap; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text); margin-bottom: .25rem; }

/* ---------- Badge-uri ---------- */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge-muted { background: #e2e8f0; color: #475569; }
.badge-primary { background: var(--primary-soft); color: var(--primary-dark); }
.badge-success { background: var(--success-soft); color: #166534; }
.badge-warning { background: var(--warning-soft); color: #92400e; }
.badge-danger { background: var(--danger-soft); color: #991b1b; }
.badge-info { background: var(--info-soft); color: #155e75; }

/* ---------- Butoane ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .4rem; padding: .55rem 1rem; border-radius: 8px; border: 1px solid transparent;
  font-weight: 600; font-size: .9rem; cursor: pointer; line-height: 1.2; text-decoration: none; transition: background .15s, box-shadow .15s;
  background: var(--surface); color: var(--text); border-color: var(--border); font-family: inherit;
}
.btn:hover { text-decoration: none; background: #f1f5f9; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #15803d; }
.btn-danger { background: #fff; color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-warning { background: var(--warning-soft); color: #92400e; border-color: #fde68a; }
.btn-sm { padding: .35rem .65rem; font-size: .8rem; }
.btn-lg { padding: .8rem 1.5rem; font-size: 1.05rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-link { background: none; border: 0; color: var(--primary); padding: 0; font-weight: 500; }
.btn-link:hover { background: none; text-decoration: underline; }
form.inline { display: inline; }

/* ---------- Formulare ---------- */
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: .3rem; }
.field .help { font-size: .8rem; color: var(--muted); margin-top: .25rem; }
.field .error { font-size: .8rem; color: var(--danger); margin-top: .25rem; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=tel], input[type=search], select, textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; color: var(--text); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
input.is-invalid, select.is-invalid, textarea.is-invalid { border-color: var(--danger); }
textarea { min-height: 90px; resize: vertical; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; font-size: .9rem; }
.check input { width: auto; }
.form-actions { display: flex; gap: .6rem; align-items: center; margin-top: 1.25rem; flex-wrap: wrap; }
.search-bar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.search-bar input { max-width: 320px; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; flex-wrap: wrap; }
.tabs a { padding: .6rem .9rem; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; margin-bottom: -1px; }
.tabs a.active { color: var(--primary); border-color: var(--primary); }
.tabs a:hover { text-decoration: none; color: var(--text); }

/* ---------- Alerte ---------- */
.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid transparent; font-size: .92rem; }
.alert-success { background: var(--success-soft); color: #166534; border-color: #bbf7d0; }
.alert-danger { background: var(--danger-soft); color: #991b1b; border-color: #fecaca; }
.alert-warning { background: var(--warning-soft); color: #92400e; border-color: #fde68a; }
.alert-info { background: var(--info-soft); color: #155e75; border-color: #a5f3fc; }

/* ---------- Definiții (detalii) ---------- */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; font-size: .92rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; }

/* ---------- Deviz: linii ---------- */
.items-table input, .items-table select { padding: .4rem .5rem; }
.items-table td { padding: .3rem .3rem; }
.items-table .col-type { width: 120px; }
.items-table .col-qty { width: 90px; }
.items-table .col-price { width: 120px; }
.items-table .col-vat { width: 90px; }
.items-table .col-total { width: 120px; text-align: right; font-weight: 600; }
.items-table .col-del { width: 40px; }
.totals { margin-left: auto; max-width: 320px; font-size: .95rem; }
.totals div { display: flex; justify-content: space-between; padding: .3rem 0; }
.totals .grand { border-top: 2px solid var(--text); font-weight: 800; font-size: 1.15rem; margin-top: .3rem; padding-top: .5rem; }

/* ---------- Onboarding ---------- */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; }
.step { border: 1px solid var(--border); border-radius: 8px; padding: .75rem; font-size: .9rem; display: flex; gap: .6rem; align-items: flex-start; }
.step .n { width: 24px; height: 24px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-dark); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; flex-shrink: 0; }
.step.done .n { background: var(--success-soft); color: #166534; }
.step.done { opacity: .7; text-decoration: line-through; }

/* ---------- Calendar săptămânal ---------- */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: .5rem; }
.day { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; min-height: 160px; padding: .5rem; }
.day.today { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.day h4 { font-size: .8rem; text-transform: uppercase; color: var(--muted); margin-bottom: .5rem; display: flex; justify-content: space-between; }
.day h4 a { font-size: 1rem; }
.appt { border-left: 3px solid var(--primary); background: #f8fafc; padding: .35rem .5rem; border-radius: 4px; font-size: .8rem; margin-bottom: .35rem; }
.appt.done { border-color: var(--success); opacity: .7; }
.appt.cancelled, .appt.no_show { border-color: var(--danger); opacity: .6; text-decoration: line-through; }
.appt strong { display: block; }

/* ---------- Paginare ---------- */
.pagination { display: flex; gap: .35rem; align-items: center; margin-top: 1rem; font-size: .9rem; }

/* ---------- Layout public ---------- */
.public { background: #fff; }
.public header.site { border-bottom: 1px solid var(--border); background: #fff; position: sticky; top: 0; z-index: 10; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }
.site-nav { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 1rem; }
.site-nav .brand { font-weight: 800; font-size: 1.3rem; color: var(--text); letter-spacing: -.02em; display: flex; align-items: center; gap: .5rem; }
.site-nav .brand span { background: var(--primary); color: #fff; border-radius: 8px; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; }
.site-nav .links { display: flex; gap: 1.25rem; align-items: center; }
.site-nav .links a { color: var(--text); font-weight: 500; }
.hero { padding: 5rem 0 3rem; text-align: center; }
.hero h1 { font-size: 2.8rem; letter-spacing: -.03em; max-width: 800px; margin: 0 auto 1rem; }
.hero p.lead { font-size: 1.2rem; color: var(--muted); max-width: 640px; margin: 0 auto 2rem; }
.hero .cta { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }
.hero .note { font-size: .85rem; color: var(--muted); margin-top: 1rem; }
.features { padding: 3rem 0; background: var(--bg); }
.features .grid-3 > div { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.features .icon { width: 42px; height: 42px; border-radius: 10px; background: var(--primary-soft); color: var(--primary-dark); display: inline-flex; align-items: center; justify-content: center; margin-bottom: .75rem; font-size: 1.3rem; }
.section { padding: 3.5rem 0; }
.section h2 { font-size: 1.9rem; text-align: center; margin-bottom: .5rem; letter-spacing: -.02em; }
.section p.sub { text-align: center; color: var(--muted); max-width: 600px; margin: 0 auto 2.5rem; }
.plans { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; max-width: 760px; margin: 0 auto; }
.plan { border: 1px solid var(--border); border-radius: 14px; padding: 1.75rem; background: #fff; }
.plan.featured { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); position: relative; }
.plan .tag { position: absolute; top: -12px; left: 1.5rem; background: var(--primary); color: #fff; font-size: .75rem; padding: .2rem .6rem; border-radius: 999px; font-weight: 700; }
.plan .price { font-size: 2.2rem; font-weight: 800; letter-spacing: -.03em; }
.plan .price small { font-size: .95rem; color: var(--muted); font-weight: 500; }
.plan ul { list-style: none; padding: 0; margin: 1.25rem 0; }
.plan li { padding: .35rem 0; padding-left: 1.5rem; position: relative; }
.plan li::before { content: "✓"; color: var(--success); position: absolute; left: 0; font-weight: 700; }
.plan li.no { color: var(--muted); }
.plan li.no::before { content: "–"; color: var(--muted); }
.steps-how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.steps-how div { text-align: center; }
.steps-how .num { width: 40px; height: 40px; border-radius: 50%; background: var(--text); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; margin-bottom: .75rem; }
footer.site { border-top: 1px solid var(--border); padding: 2rem 0; font-size: .85rem; color: var(--muted); }
footer.site .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
footer.site a { color: var(--muted); margin-right: 1rem; }
.auth-box { max-width: 440px; margin: 3rem auto; }
.auth-box .card { padding: 2rem; }
.prose { max-width: 760px; margin: 2rem auto; }
.prose h2 { margin-top: 2rem; font-size: 1.3rem; }
.faq details { border-bottom: 1px solid var(--border); padding: .75rem 0; }
.faq summary { font-weight: 600; cursor: pointer; }

/* ---------- Deviz public ---------- */
.deviz-public { max-width: 780px; margin: 2rem auto; }
.deviz-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .week { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .sidebar nav { display: none; padding-bottom: .5rem; }
  .sidebar.open nav { display: block; }
  .sidebar .brand { justify-content: space-between; }
  .sidebar .user { display: none; }
  .sidebar.open .user { display: block; }
  .menu-toggle { display: inline-flex; background: none; border: 1px solid rgba(255,255,255,.2); color: #fff; border-radius: 6px; padding: .3rem .6rem; cursor: pointer; }
  .content { padding: 1rem; }
  .banner { padding: .65rem 1rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2rem; }
  html { font-size: 14px; }
  .plans, .steps-how { grid-template-columns: 1fr; }
  .site-nav .links a.hide-mobile { display: none; }
  .dl { grid-template-columns: 1fr; }
}
@media (min-width: 861px) { .menu-toggle { display: none; } }
