/* ═══════════════════════════════════════════════════
   AvoApp — Design System v2
   ═══════════════════════════════════════════════════ */

:root {
  /* Palette */
  --gold:        #b8952a;
  --gold-light:  #d4af55;
  --gold-dim:    #7a6220;
  --gold-bg:     rgba(184,149,42,.10);
  --gold-border: rgba(184,149,42,.25);

  --ink:         #1a1815;
  --ink-2:       #2e2b27;
  --ink-3:       #6b6660;

  --paper:       #f7f4ee;
  --paper-2:     #eee9e0;
  --paper-3:     #e2dcd2;

  --white:       #ffffff;

  --red:         #c0392b;
  --red-light:   #e55245;
  --red-bg:      rgba(192,57,43,.08);

  --green:       #1a6b3a;
  --green-bg:    rgba(26,107,58,.08);

  --blue:        #2471a3;
  --blue-bg:     rgba(36,113,163,.08);

  --orange:      #b8952a;

  /* Typography */
  --font-serif: 'Libre Baskerville', Georgia, serif;
  --font-sans:  'DM Sans', system-ui, -apple-system, sans-serif;

  /* Spacing */
  --radius:     7px;
  --radius-lg:  12px;
  --radius-xl:  18px;

  /* Shadows */
  --shadow-sm:  0 1px 2px rgba(14,13,12,.06), 0 1px 4px rgba(14,13,12,.06);
  --shadow-md:  0 2px 8px rgba(14,13,12,.08), 0 4px 16px rgba(14,13,12,.06);
  --shadow-lg:  0 8px 24px rgba(14,13,12,.11), 0 2px 8px rgba(14,13,12,.06);
  --shadow-xl:  0 20px 48px rgba(14,13,12,.16), 0 6px 16px rgba(14,13,12,.08);

  /* Layout */
  --nav-h:      60px;
  --sidebar-w:  310px;

  /* Transitions */
  --t:          .15s cubic-bezier(.4,0,.2,1);
}

/* ── Reset ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

img, svg { display: block; max-width: 100%; }

ul[role="list"] { list-style: none; }

/* ── Typography ─────────────────────────────────── */
h1, h2, h3, h4, h5 {
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
}
h1 { font-size: clamp(1.5rem, 4vw, 2rem); }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }

.serif  { font-family: var(--font-serif); }
.muted  { color: var(--ink-3); }
.small  { font-size: .85rem; }

/* ── Navigation ─────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 1rem;
  height: var(--nav-h);
  padding: 0 1.5rem;
  background: var(--ink);
  border-bottom: 1px solid rgba(184,149,42,.2);
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
}

.nav__brand { display: flex; align-items: center; }

.nav__logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--gold);
  text-decoration: none;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: -.01em;
}
.nav__logo:hover { color: var(--gold-light); text-decoration: none; }
.nav__logo-icon { font-size: 1.25rem; }
.nav__logo-text { display: inline; }

.nav__links {
  display: flex;
  gap: .15rem;
  flex: 1;
  list-style: none;
  margin-left: .75rem;
}

.nav__link {
  padding: .4rem .8rem;
  border-radius: var(--radius);
  color: rgba(237,233,224,.7);
  font-size: .875rem;
  font-weight: 500;
  transition: background var(--t), color var(--t);
  text-decoration: none;
  white-space: nowrap;
}
.nav__link:hover { background: rgba(184,149,42,.12); color: var(--gold-light); text-decoration: none; }
.nav__link--active { background: rgba(184,149,42,.15); color: var(--gold-light); }

/* Search button */
.nav__search-btn {
  display: flex;
  align-items: center;
  gap: .35rem;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(237,233,224,.65);
  padding: .32rem .75rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .8rem;
  font-family: var(--font-sans);
  margin-right: .25rem;
  transition: background var(--t), border-color var(--t);
  white-space: nowrap;
}
.nav__search-btn:hover {
  background: rgba(255,255,255,.11);
  border-color: rgba(184,149,42,.3);
  color: rgba(237,233,224,.9);
}
.nav__search-hint { color: rgba(237,233,224,.35); font-size: .7rem; }

/* User dropdown */
.nav__user { position: relative; margin-left: auto; }

.nav__user-btn {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .38rem .75rem;
  background: rgba(184,149,42,.1);
  border: 1px solid rgba(184,149,42,.25);
  border-radius: var(--radius);
  color: var(--paper-2);
  font-family: var(--font-sans);
  font-size: .85rem;
  cursor: pointer;
  transition: background var(--t);
  white-space: nowrap;
}
.nav__user-btn:hover { background: rgba(184,149,42,.18); }

.nav__user-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav__user-chevron { font-size: .7rem; opacity: .7; }

.nav__dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 170px;
  background: var(--ink-2);
  border: 1px solid rgba(184,149,42,.2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.nav__dropdown-item {
  display: block;
  width: 100%;
  padding: .65rem 1.1rem;
  color: rgba(237,233,224,.8);
  font-size: .875rem;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background var(--t), color var(--t);
  text-decoration: none;
  font-family: var(--font-sans);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.nav__dropdown-item:last-child { border-bottom: none; }
.nav__dropdown-item:hover { background: rgba(255,255,255,.07); color: var(--paper); text-decoration: none; }
.nav__dropdown-item--danger { color: rgba(229,82,69,.85); }
.nav__dropdown-item--danger:hover { background: rgba(192,57,43,.2); color: var(--red-light); }

/* Hamburger */
.nav__hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  padding: 6px;
  background: none;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius);
  cursor: pointer;
  margin-left: auto;
}
.nav__hamburger span {
  display: block;
  height: 2px;
  background: var(--paper-2);
  border-radius: 2px;
  transition: transform var(--t), opacity var(--t);
}

/* Mobile nav drawer */
.nav__mobile-menu {
  display: none;
  position: fixed;
  top: var(--nav-h);
  left: 0;
  right: 0;
  background: var(--ink-2);
  border-bottom: 1px solid rgba(184,149,42,.2);
  box-shadow: var(--shadow-lg);
  z-index: 190;
  padding: .75rem 1rem 1rem;
}
.nav__mobile-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .2rem;
  margin-bottom: .75rem;
}
.nav__mobile-links .nav__link {
  padding: .6rem .85rem;
  display: block;
  color: rgba(237,233,224,.8);
}

/* ── Main content ───────────────────────────────── */
.main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}
.main--full { max-width: 100%; padding: 0; }

/* ── Cards ──────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--paper-3);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t);
}

.card--hover:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--paper-2);
  gap: .75rem;
}
.card__title {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--ink);
  font-weight: 700;
}

/* Stat card accent variant */
.card--stat {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  color: inherit;
  flex: 1;
  min-width: 140px;
}
.card--stat:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); text-decoration: none; color: inherit; }
.card--stat__num {
  font-size: 2.2rem;
  font-weight: 700;
  font-family: var(--font-serif);
  line-height: 1;
}
.card--stat__label { font-size: .8rem; color: var(--ink-3); margin-top: .2rem; line-height: 1.3; }

/* ── Buttons ────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .55rem 1.15rem;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background var(--t), box-shadow var(--t), transform var(--t), color var(--t);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
  letter-spacing: .01em;
}
.btn:active { transform: translateY(1px); box-shadow: none !important; }

.btn--primary {
  background: var(--gold);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(184,149,42,.3), 0 2px 8px rgba(184,149,42,.15);
}
.btn--primary:hover {
  background: var(--gold-light);
  box-shadow: 0 2px 6px rgba(184,149,42,.4), 0 4px 12px rgba(184,149,42,.2);
  text-decoration: none;
  color: var(--ink);
}

.btn--secondary {
  background: var(--white);
  color: var(--ink-2);
  border: 1px solid var(--paper-3);
  box-shadow: var(--shadow-sm);
}
.btn--secondary:hover { background: var(--paper); border-color: var(--paper-3); text-decoration: none; color: var(--ink); box-shadow: var(--shadow-md); }

.btn--danger {
  background: transparent;
  color: var(--red);
  border: 1px solid rgba(192,57,43,.4);
}
.btn--danger:hover { background: var(--red); color: #fff; border-color: var(--red); text-decoration: none; }

.btn--ghost {
  background: transparent;
  color: var(--ink-3);
  border: 1px solid transparent;
}
.btn--ghost:hover { background: var(--paper-2); color: var(--ink); text-decoration: none; border-color: var(--paper-3); }

.btn--sm  { padding: .35rem .75rem; font-size: .8rem; }
.btn--lg  { padding: .7rem 1.5rem; font-size: .95rem; }

/* ── Forms ──────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  margin-bottom: 1.1rem;
}

.form-label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: .02em;
}
.form-label--required::after { content: ' *'; color: var(--red); }

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: .6rem .9rem;
  background: var(--white);
  border: 1.5px solid var(--paper-3);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: .9rem;
  color: var(--ink);
  transition: border-color var(--t), box-shadow var(--t);
  outline: none;
  -webkit-appearance: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184,149,42,.12);
}
.form-input::placeholder { color: var(--ink-3); opacity: .6; }
.form-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

.form-error { font-size: .78rem; color: var(--red); }
.form-help  { font-size: .78rem; color: var(--ink-3); }

/* ── Auth pages ─────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  padding: 2rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border: 1px solid var(--paper-3);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
}

.auth-card__logo {
  text-align: center;
  margin-bottom: 2rem;
}
.auth-card__logo-icon {
  font-size: 2.5rem;
  margin-bottom: .4rem;
}
.auth-card__logo-text {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  color: var(--gold);
  letter-spacing: -.02em;
}
.auth-card__logo-sub {
  font-size: .78rem;
  color: var(--ink-3);
  margin-top: .2rem;
}
.auth-card__title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
  text-align: center;
  color: var(--ink);
}
.auth-card__footer {
  margin-top: 1.25rem;
  text-align: center;
  font-size: .85rem;
  color: var(--ink-3);
}

/* ── Toasts ─────────────────────────────────────── */
.toast-zone {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-width: 360px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .75rem 1rem;
  border-radius: var(--radius-lg);
  font-size: .875rem;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid transparent;
  pointer-events: all;
  backdrop-filter: blur(8px);
}
.toast--success { background: #fff; border-color: var(--green);  color: var(--ink); }
.toast--error,
.toast--danger  { background: #fff; border-color: var(--red);    color: var(--ink); }
.toast--warning { background: #fff; border-color: var(--gold);   color: var(--ink); }
.toast--info    { background: #fff; border-color: var(--blue);   color: var(--ink); }

.toast__msg   { flex: 1; line-height: 1.4; }
.toast__close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-3);
  font-size: .8rem;
  padding: .2rem .35rem;
  border-radius: var(--radius);
  flex-shrink: 0;
  transition: background var(--t);
}
.toast__close:hover { background: var(--paper-2); color: var(--ink); }

/* ── Tags / chips ────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: .18rem .55rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
  background: var(--paper-2);
  color: var(--ink-2);
  border: 1px solid var(--paper-3);
}
.tag--urgent            { background: var(--red-bg);   color: var(--red);      border-color: rgba(192,57,43,.15); }
.tag--client-de-sunat   { background: var(--gold-bg);  color: var(--gold-dim); border-color: var(--gold-border); }
.tag--document-de-depus { background: var(--blue-bg);  color: var(--blue);     border-color: rgba(36,113,163,.15); }
.tag--termen-intern     { background: rgba(125,60,152,.08); color: #7d3c98;    border-color: rgba(125,60,152,.15); }

/* ── Badge ───────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .6rem;
  border-radius: var(--radius);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.badge--red  { background: var(--red-bg);   color: var(--red);     border: 1px solid rgba(192,57,43,.15); }
.badge--gold { background: var(--gold-bg);  color: var(--gold-dim); border: 1px solid var(--gold-border); }
.badge--blue { background: var(--blue-bg);  color: var(--blue);    border: 1px solid rgba(36,113,163,.15); }
.badge--gray { background: var(--paper-2);  color: var(--ink-3);   border: 1px solid var(--paper-3); }
.badge--green{ background: var(--green-bg); color: var(--green);   border: 1px solid rgba(26,107,58,.15); }

/* ── Urgency dot ─────────────────────────────────── */
.urgency { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.urgency--red    { background: var(--red); box-shadow: 0 0 4px rgba(192,57,43,.4); }
.urgency--yellow { background: var(--gold); }
.urgency--green  { background: var(--green); }
.urgency--blue   { background: var(--blue); }
.urgency--gray   { background: var(--paper-3); }

/* ── Empty state ─────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--ink-3);
}
.empty-state__icon  { font-size: 3rem; margin-bottom: 1rem; opacity: .35; }
.empty-state__title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--ink-2);
  margin-bottom: .4rem;
}
.empty-state__text  { font-size: .875rem; max-width: 340px; margin: 0 auto 1.5rem; line-height: 1.6; }

/* ── Landing page ────────────────────────────────── */
.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--ink);
  color: var(--paper);
}
.landing__logo {
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 8vw, 3.5rem);
  color: var(--gold);
  margin-bottom: .5rem;
  letter-spacing: -.02em;
}
.landing__tagline {
  font-size: 1.05rem;
  color: rgba(237,233,224,.65);
  margin-bottom: 2.5rem;
  max-width: 480px;
  line-height: 1.7;
}
.landing__actions { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }

/* ── Divider ─────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--paper-3);
  margin: 1.25rem 0;
}

/* ── Spinner / loading ───────────────────────────── */
.htmx-indicator {
  opacity: 0;
  transition: opacity .2s;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { opacity: 1; }

@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--paper-3);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  flex-shrink: 0;
}

/* ── HTMX content fade-in ────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.htmx-added       { animation: fadeIn .2s ease; }

/* ── Modal ───────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(14,13,12,.5);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(2px);
}
.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}
.modal__header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--paper-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal__title { font-family: var(--font-serif); font-size: 1.1rem; }
.modal__body  { padding: 1.5rem; }
.modal__footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--paper-2);
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
}

/* ── Dosare layout ───────────────────────────────── */
body:has(#dosare-layout) .main { max-width: 100%; padding: 0; }

.dosare-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - var(--nav-h));
}

/* Sidebar */
.sidebar {
  background: var(--white);
  border-right: 1px solid var(--paper-3);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow: hidden;
}

.sidebar__header {
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--paper-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-shrink: 0;
  background: var(--white);
}

.sidebar__title {
  font-family: var(--font-serif);
  font-size: .95rem;
  font-weight: 700;
  color: var(--ink);
}

.sidebar__list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--paper-3) transparent;
}
.sidebar__list::-webkit-scrollbar { width: 4px; }
.sidebar__list::-webkit-scrollbar-track { background: transparent; }
.sidebar__list::-webkit-scrollbar-thumb { background: var(--paper-3); border-radius: 2px; }

/* Dosar card in sidebar */
.dosar-card {
  display: block;
  padding: .8rem 1.1rem;
  border-bottom: 1px solid var(--paper-2);
  cursor: pointer;
  transition: background var(--t);
  text-decoration: none;
  color: inherit;
  position: relative;
  border-left: 3px solid transparent;
}
.dosar-card:hover { background: var(--paper); text-decoration: none; }
.dosar-card--active {
  background: var(--gold-bg);
  border-left-color: var(--gold);
}
.dosar-card__num {
  font-family: var(--font-serif);
  font-size: .9rem;
  color: var(--ink);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 1.5rem;
}
.dosar-card__parti {
  font-size: .75rem;
  color: var(--ink-3);
  margin-top: .1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 1.5rem;
}
.dosar-card__desc {
  font-size: .75rem;
  color: var(--ink-3);
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 1.5rem;
}
.dosar-card__date {
  font-size: .72rem;
  color: var(--gold-dim);
  margin-top: .2rem;
  font-weight: 500;
}
.dosar-card__urgency { position: absolute; top: .9rem; right: .75rem; }

/* Detail pane */
.detail-pane {
  padding: 2rem;
  overflow-y: auto;
  background: var(--paper);
  min-height: calc(100vh - var(--nav-h));
}

/* Add form zone */
#add-form-zone {
  border-bottom: 1px solid var(--paper-2);
  background: var(--paper);
}

/* ── Calendar rows ───────────────────────────────── */
.cal-row {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  align-items: center;
  gap: .75rem;
  padding: .7rem 1rem;
  border-radius: var(--radius-lg);
  background: var(--white);
  text-decoration: none;
  color: inherit;
  transition: box-shadow var(--t), transform var(--t);
  border-left: 3px solid transparent;
  box-shadow: var(--shadow-sm);
}
.cal-row:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  text-decoration: none;
}
.cal-row--red  { border-left-color: var(--red); }
.cal-row--gold { border-left-color: var(--gold); }
.cal-row--blue { border-left-color: var(--blue); }
.cal-row--gray { border-left-color: var(--paper-3); opacity: .65; }

/* ── Utilities ───────────────────────────────────── */
.flex          { display: flex; }
.flex-col      { flex-direction: column; }
.flex-wrap     { flex-wrap: wrap; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-1   { gap: .25rem; }
.gap-2   { gap: .5rem; }
.gap-3   { gap: .75rem; }
.gap-4   { gap: 1rem; }
.mt-1    { margin-top: .25rem; }
.mt-2    { margin-top: .5rem; }
.mt-3    { margin-top: .75rem; }
.mt-4    { margin-top: 1rem; }
.mb-4    { margin-bottom: 1rem; }
.w-full  { width: 100%; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

/* ── Responsive ──────────────────────────────────── */

/* Tablet (≤ 900px) */
@media (max-width: 900px) {
  :root { --sidebar-w: 260px; }
  .nav { padding: 0 1rem; gap: .75rem; }
  .nav__search-btn .nav__search-hint { display: none; }
  .main { padding: 1.5rem 1rem; }
}

/* Mobile (≤ 680px) */
@media (max-width: 680px) {
  .nav__links       { display: none; }
  .nav__search-btn  { display: none; }
  .nav__hamburger   { display: flex; }
  .nav__user        { margin-left: 0; }
  .nav__user-name   { display: none; }
  .nav__user-btn    { padding: .38rem .55rem; }

  .nav__mobile-menu { display: block; }

  .main { padding: 1rem .875rem; }
  .auth-card { padding: 1.75rem 1.25rem; }

  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.2rem; }

  /* Dosare: stacked layout with tab bar */
  body:has(#dosare-layout) .main { padding: 0; }
  .dosare-layout { grid-template-columns: 1fr; }

  .sidebar {
    position: static;
    height: auto;
    max-height: 42vh;
    border-right: none;
    border-bottom: 2px solid var(--paper-3);
  }

  .detail-pane { padding: 1rem .875rem; min-height: unset; }

  /* Calendar rows: 2-col on mobile */
  .cal-row { grid-template-columns: 80px 1fr; }
  .cal-row > *:last-child { grid-column: span 2; justify-self: start; }

  /* Toast zone */
  .toast-zone { left: .75rem; right: .75rem; max-width: 100%; bottom: 1rem; }

  /* Cards */
  .card { padding: 1.1rem; }
  .card--stat { padding: 1rem 1.1rem; }
  .card--stat__num { font-size: 1.8rem; }
}

/* Very small (≤ 380px) */
@media (max-width: 380px) {
  .nav__hamburger { margin-left: auto; }
  .nav__user-btn { display: none; }
  .nav__logo-text { display: none; }
}
