/* ═══════════════════════════════════════════════════════
   Bacheca Offerte — Corporate / Modern
   Design system: B2B Contact Portal
   ═══════════════════════════════════════════════════════ */

/* ── Design tokens ──────────────────────────────────── */
:root {
  --navy:              #000000;
  --navy-deep:         #1a1a1a;
  --navy-soft:         #dee0ff;
  --navy-light:        #f0f2ff;
  --citron:            #d8ed76;
  --citron-dim:        #bcd05d;
  --citron-text:       #5c6b00;
  --green:             #009142;
  --green-container:   #d1fae5;
  --green-text:        #005323;
  --amber:             #b45309;
  --amber-container:   #fef3c7;
  --red:               #ba1a1a;
  --red-container:     #ffdad6;

  --bg:                #f8f9fb;
  --surface:           #ffffff;
  --surface-low:       #f3f4f6;
  --surface-high:      #e7e8ea;
  --surface-highest:   #e1e2e4;

  --text:              #191c1e;
  --text-muted:        #454650;
  --text-faint:        #767681;

  --border:            #c6c5d1;
  --border-light:      rgba(198, 197, 209, 0.55);

  --shadow-sm:  0 1px 2px rgba(0,11,71,0.05);
  --shadow-md:  0 2px 6px rgba(0,11,71,0.06), 0 1px 2px rgba(0,11,71,0.04);
  --shadow-lg:  0 4px 16px rgba(0,11,71,0.08);
  --shadow-xl:  0 8px 24px rgba(0,11,71,0.10);
  --shadow-hdr: 0 2px 8px rgba(0,11,71,0.22);

  --r-sm:   0.25rem;
  --r-md:   0.5rem;
  --r-lg:   0.75rem;
  --r-xl:   1rem;
  --r-full: 9999px;
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body.app-body {
  min-height: 100svh;
  font-family: 'Hanken Grotesk', 'Segoe UI Variable', 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

button, input, textarea, select { font: inherit; }

::-webkit-scrollbar          { width: 5px; height: 5px; }
::-webkit-scrollbar-track    { background: transparent; }
::-webkit-scrollbar-thumb    { background: var(--border); border-radius: var(--r-full); }

/* ── Header ──────────────────────────────────────── */
.dashboard-header {
  background: var(--navy);
  color: #fff;
  box-shadow: var(--shadow-hdr);
}

.dashboard-header__inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.875rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
@media (max-width: 640px) {
  .dashboard-header__inner { padding-inline: 1rem; }
}

.dashboard-brand { display: flex; align-items: center; gap: 0.625rem; min-width: 0; }
.dashboard-brand__icon  { width: 1.25rem; height: 1.25rem; flex: 0 0 auto; }
.dashboard-brand__title { font-size: 1rem; font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; }
.dashboard-brand__logo  { height: 2rem; width: auto; flex: 0 0 auto; display: block; filter: brightness(0) invert(1); }

.dashboard-actions {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-user-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-sep {
  width: 1px;
  height: 1.25rem;
  background: rgba(255,255,255,0.2);
  border-radius: 1px;
  flex-shrink: 0;
}

.header-avatar {
  width: 1.875rem;
  height: 1.875rem;
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  font-size: 0.75rem;
  font-weight: 700;
}
.header-user {
  font-size: 0.875rem;
  font-weight: 600;
  opacity: 0.85;
  white-space: nowrap;
}
.header-btn-secondary {
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.08);
  border-radius: var(--r-md);
  color: rgba(255,255,255,0.9);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.header-btn-secondary:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.38);
  color: #fff;
}

.header-link {
  border: 0;
  background: transparent;
  color: rgba(255,255,255,0.55);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.3rem 0;
  cursor: pointer;
  transition: color 0.15s;
}
.header-link:hover {
  color: rgba(255,255,255,0.85);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}
.header-link--exit {
  color: rgba(255,180,180,0.75);
}
.header-link--exit:hover {
  color: #ffaaaa;
}

.header-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 0;
  border-radius: var(--r-full);
  background: var(--citron);
  color: var(--citron-text);
  font-size: 0.875rem;
  font-weight: 700;
  padding: 0.5rem 1rem;
  box-shadow: 0 2px 8px rgba(0,11,71,0.18);
  transition: background-color 0.15s, transform 0.15s, box-shadow 0.15s;
  cursor: pointer;
}
.header-primary:hover {
  background: var(--citron-dim);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,11,71,0.22);
}
.header-primary:active { transform: translateY(0); }

/* ── Shell ───────────────────────────────────────── */
.dashboard-shell { max-width: 72rem; margin: 0 auto; padding-inline: 1.5rem; }
@media (max-width: 640px) { .dashboard-shell { padding-inline: 1rem; } }

/* ── Toolbar ─────────────────────────────────────── */
.dashboard-toolbar {
  margin-top: 1.25rem;
  padding: 1rem 1.125rem;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-light);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.dashboard-toolbar__search { position: relative; }

.search-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  width: 0.9375rem;
  height: 0.9375rem;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}
.search-input {
  width: 100%;
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  background: var(--surface-low);
  padding: 0.75rem 1rem 0.75rem 2.375rem;
  font-size: 0.9375rem;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.search-input::placeholder { color: var(--text-faint); }
.search-input:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(0,11,71,0.08);
  background: var(--surface);
}

.dashboard-toolbar__filters {
  margin-top: 0.875rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.filter-group { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.filter-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.filter-group--users { margin-left: auto; justify-content: flex-end; }

/* ── Chips ───────────────────────────────────────── */
.chip {
  padding: 0.3125rem 0.75rem;
  border-radius: var(--r-sm);
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border-light);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
  white-space: nowrap;
}
.chip:hover { border-color: var(--navy); color: var(--navy); }
.chip-active { background: var(--citron); border-color: var(--citron-dim); color: var(--citron-text); }
.chip-active:hover { background: var(--citron-dim); border-color: var(--citron-dim); color: var(--citron-text); }

/* ── Entry list ──────────────────────────────────── */
.dashboard-list { padding-top: 1.25rem; padding-bottom: 6rem; }

.entry-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.entry-card {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  border: 1px solid var(--border-light);
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 1rem 1.125rem;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s, background-color 0.15s;
}
.entry-card:hover {
  transform: translateY(-1px);
  border-color: rgba(0,11,71,0.18);
  box-shadow: var(--shadow-lg);
  background: var(--surface-low);
}

.entry-dot {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: var(--r-full);
  margin-top: 0.45rem;
  flex: 0 0 auto;
}

.entry-content { flex: 1 1 auto; min-width: 0; }

.entry-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.entry-main { min-width: 0; flex: 1 1 auto; }

.entry-title { margin: 0; font-size: 0.9375rem; font-weight: 700; color: var(--text); line-height: 1.35; }
.entry-note  { margin-top: 0.25rem; font-size: 0.875rem; color: var(--text-muted); line-height: 1.5; }

.entry-footer { margin-top: 0.75rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.entry-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.1875rem 0.5625rem;
  border-radius: var(--r-sm);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: 'JetBrains Mono', monospace;
}
.entry-pill--new      { background: var(--surface-high);      color: var(--text-muted); }
.entry-pill--verified { background: var(--amber-container);   color: var(--amber); }
.entry-pill--done     { background: var(--green-container);   color: var(--green-text); }

.entry-latest { font-size: 0.8125rem; font-weight: 400; color: var(--text-faint); }

.entry-side {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.125rem;
  min-width: 9rem;
  text-align: right;
}
.entry-user { display: flex; align-items: center; gap: 0.5rem; justify-content: flex-end; }

.entry-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: var(--navy);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.entry-user-copy { min-width: 0; }
.entry-user-name { margin: 0; font-size: 0.875rem; font-weight: 700; color: var(--text); line-height: 1.2; }
.entry-date {
  margin: 0.1rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.2;
  font-family: 'JetBrains Mono', monospace;
}

.entry-chevron { flex: 0 0 auto; align-self: center; color: var(--border); }
.entry-chevron svg { width: 1rem; height: 1rem; }

@media (max-width: 640px) {
  .entry-card  { flex-wrap: wrap; }
  .entry-top   { flex-direction: column; gap: 0.5rem; }
  .entry-side  { width: 100%; align-items: flex-start; text-align: left; min-width: 0; }
  .entry-user  { justify-content: flex-start; }
}

/* ── Skeleton ─────────────────────────────────────── */
.skeleton-card {
  height: 6.25rem;
  border-radius: var(--r-lg);
  background: linear-gradient(90deg, var(--surface-high) 25%, var(--surface-highest) 50%, var(--surface-high) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  margin-top: 0.625rem;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Empty state ─────────────────────────────────── */
.dashboard-empty {
  min-height: 14rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  margin-top: 1.5rem;
  border: 1px dashed var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.dashboard-empty svg                { color: var(--border); }
.dashboard-empty p:first-of-type    { color: var(--text-muted); font-weight: 600; font-size: 1rem; }
.dashboard-empty p:last-of-type     { color: var(--text-faint); font-size: 0.875rem; }

/* ── Detail summary ──────────────────────────────── */
.detail-summary {
  padding: 1rem 1.125rem;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-light);
  background: var(--surface-low);
}
.detail-summary__header    { margin-bottom: 0.75rem; }
.detail-summary__eyebrow {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}
.detail-summary__title    { margin: 0.25rem 0 0; font-size: 1rem; font-weight: 700; color: var(--text); line-height: 1.3; }
.detail-summary__subtitle { margin: 0.25rem 0 0; font-size: 0.875rem; color: var(--text-muted); line-height: 1.45; }
.detail-summary__list     { display: grid; gap: 0.5rem; }

.detail-summary__item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: var(--r-md);
  border: 1px solid var(--border-light);
  background: var(--surface);
}
.detail-summary__accent {
  width: 0.5625rem;
  height: 0.5625rem;
  margin-top: 0.35rem;
  border-radius: var(--r-full);
  flex: 0 0 auto;
}
.detail-summary__accent--blue    { background: var(--navy); }
.detail-summary__accent--amber   { background: var(--amber); }
.detail-summary__accent--emerald { background: var(--green); }
.detail-summary__accent--slate   { background: var(--text-faint); }

.detail-summary__copy  { min-width: 0; flex: 1 1 auto; }
.detail-summary__label { margin: 0; display: flex; flex-wrap: wrap; gap: 0.375rem; align-items: center; }

.detail-summary__badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.4375rem;
  border-radius: var(--r-sm);
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: 'JetBrains Mono', monospace;
}
.detail-summary__badge--blue    { background: var(--navy-soft);        color: var(--navy-deep); }
.detail-summary__badge--amber   { background: var(--amber-container);  color: var(--amber); }
.detail-summary__badge--emerald { background: var(--green-container);  color: var(--green-text); }
.detail-summary__badge--slate   { background: var(--surface-high);     color: var(--text-muted); }

.detail-summary__value  { margin: 0.25rem 0 0; font-size: 0.875rem; font-weight: 600; line-height: 1.35; color: var(--text); }
.detail-summary__value strong { font-weight: 800; }
.detail-summary__detail {
  margin: 0.125rem 0 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* ── Detail modal fixed layout ──────────────────── */
dialog#detail-modal {
  height: 90dvh;
  max-height: 900px;
}
@media (min-width: 768px) {
  dialog#detail-modal {
    max-width: 72rem;
  }
}
@media (max-width: 640px) {
  dialog#detail-modal {
    height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 1.5rem);
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 1.5rem);
    margin-top: max(0.75rem, env(safe-area-inset-top, 0px));
    margin-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
    margin-inline: auto;
  }
}
dialog#detail-modal[open] {
  display: flex;
  flex-direction: column;
}

/* ── Detail body two-column grid ────────────────── */
.detail-body-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 480px) {
  .detail-body-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem 1.5rem;
    align-items: start;
  }
}

/* ── Toggle ──────────────────────────────────────── */
.toggle-wrap  { display: inline-flex; align-items: center; }
.toggle-track {
  position: relative;
  width: 2.5rem;
  height: 1.375rem;
  border-radius: var(--r-full);
  transition: background-color 0.2s;
  cursor: pointer;
}
.toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1rem;
  height: 1rem;
  background: #fff;
  border-radius: var(--r-full);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.2s;
}
input:checked ~ .toggle-track .toggle-knob,
input:checked + .toggle-track .toggle-knob { transform: translateX(1.125rem); }

/* ── Dialog ──────────────────────────────────────── */
dialog { margin: auto; box-shadow: var(--shadow-xl); }
dialog::backdrop { background: rgba(0,11,71,0.38); }

/* ── Utilities ───────────────────────────────────── */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media print {
  header, #search-bar, #filter-chips, .btn-delete,
  .toggle-wrap, #btn-add, dialog { display: none !important; }
}
