/* DESK — High-Contrast App Styles */

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

:root {
  --bg:           #09111C;
  --surface:      #0F1E30;
  --panel:        #152338;
  --panel-head:   #1A2D44;
  --panel-hover:  #203550;
  --input-bg:     #1C2F48;
  --border:       #3A5878;
  --border-dim:   #253C58;
  --border-input: #4A6E90;
  --amber:        #F5A623;
  --amber-dim:    #C07810;
  --amber-glow:   rgba(245,166,35,.18);
  --amber-glow2:  rgba(245,166,35,.08);
  --teal:         #1ED8EE;
  --red:          #FF6B6B;
  --green:        #34D399;
  --text-1:       #FFFFFF;
  --text-2:       #C8DCEF;
  --text-3:       #8AAFC8;
  --text-inv:     #0A121C;
  --radius:       5px;
  --radius-lg:    10px;
  --sidebar-w:    260px;
  font-size: 14px;
}

html, body { height: 100%; background: var(--bg); color: var(--text-1); font-family: 'IBM Plex Sans', sans-serif; overflow: hidden; }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

/* ── Layout ──────────────────────────────────────── */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; }
.workspace { display: flex; flex-direction: column; overflow: hidden; background: var(--bg); background-image: linear-gradient(rgba(58,88,120,.18) 1px,transparent 1px), linear-gradient(90deg,rgba(58,88,120,.18) 1px,transparent 1px); background-size: 32px 32px; }

/* ── Sidebar ─────────────────────────────────────── */
.sidebar { background: var(--surface); border-right: 1.5px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
.sidebar-logo { padding: 26px 22px 20px; border-bottom: 1px solid var(--border-dim); flex-shrink: 0; cursor: pointer; }
.logo-mark { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 22px; letter-spacing: -.5px; color: #fff; display: flex; align-items: center; gap: 9px; }
.logo-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--amber); display: inline-block; box-shadow: 0 0 10px var(--amber); flex-shrink: 0; }
.logo-sub { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--text-3); letter-spacing: .12em; text-transform: uppercase; margin-top: 5px; }
.sidebar-nav { padding: 16px 12px; flex-shrink: 0; }
.nav-label { font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--text-3); padding: 0 12px; margin-bottom: 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius); color: var(--text-2); cursor: pointer; font-size: 13.5px; font-weight: 500; transition: background .15s, color .15s; user-select: none; border: 1px solid transparent; }
.nav-item:hover { background: var(--panel-hover); color: #fff; }
.nav-item.active { background: var(--amber-glow); color: var(--amber); border-color: rgba(245,166,35,.25); }
.nav-icon { width: 16px; height: 16px; opacity: .85; flex-shrink: 0; }
.nav-item.active .nav-icon { opacity: 1; }
.sidebar-projects { padding: 18px 14px 12px; flex: 1; overflow-y: auto; border-top: 1px solid var(--border-dim); }
.sidebar-projects .nav-label { margin-bottom: 12px; }
.sidebar-projects .project-entry:last-child { margin-bottom: 0; }
.sidebar-projects::-webkit-scrollbar { width: 4px; }
.sidebar-projects::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.project-entry { padding: 11px 13px; border-radius: var(--radius); cursor: pointer; transition: background .15s; margin-bottom: 7px; border: 1px solid transparent; }
.project-entry:hover { background: var(--panel-hover); border-color: var(--border-dim); }
.project-entry.active { background: var(--panel); border: 1px solid var(--border-dim); border-left: 3px solid var(--amber); padding-left: 10px; }
.project-entry-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-entry-meta { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--text-3); margin-top: 2px; }
.sidebar-settings-item { flex-shrink: 0; padding: 10px 12px; border-top: 1px solid var(--border-dim); }
.sidebar-footer { padding: 14px 16px; border-top: 1px solid var(--border-dim); flex-shrink: 0; }
.btn-new-project { width: 100%; padding: 10px 0; background: var(--amber); border: none; border-radius: var(--radius); color: var(--text-inv); font-family: 'IBM Plex Sans', sans-serif; font-size: 13px; font-weight: 700; cursor: pointer; transition: background .15s, box-shadow .15s; display: flex; align-items: center; justify-content: center; gap: 7px; }
.btn-new-project:hover { background: #FFB840; box-shadow: 0 4px 20px rgba(245,166,35,.4); }

/* ── Workspace Header ────────────────────────────── */
.ws-header { display: flex; align-items: center; justify-content: space-between; padding: 0 32px; height: 56px; border-bottom: 1.5px solid var(--border); background: rgba(9,17,28,.93); backdrop-filter: blur(8px); flex-shrink: 0; z-index: 10; }
.ws-breadcrumb { display: flex; align-items: center; gap: 8px; font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; color: var(--text-3); flex-wrap: wrap; }
.ws-breadcrumb a { color: var(--text-2); text-decoration: none; cursor: pointer; }
.ws-breadcrumb a:hover { color: #fff; }
.ws-breadcrumb .sep { color: var(--border); }
.ws-breadcrumb .current { color: #fff; font-family: 'IBM Plex Sans', sans-serif; font-size: 13px; font-weight: 600; }
.ws-actions { display: flex; align-items: center; gap: 10px; }

/* ── Buttons ─────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px; border-radius: var(--radius); font-family: 'IBM Plex Sans', sans-serif; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; border: 1.5px solid transparent; line-height: 1; user-select: none; outline: none; }
.btn:focus { outline: none; }
.btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-loading { pointer-events: none; opacity: .8; }
.btn-loading::before { content: ''; display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: spin .7s linear infinite; margin-right: 4px; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { background: var(--panel); color: #fff; border-color: var(--border-input); }
.btn-primary { background: var(--amber); border-color: var(--amber); color: var(--text-inv); font-weight: 700; }
.btn-primary:hover { background: #FFB840; box-shadow: 0 0 24px rgba(245,166,35,.35); }
.btn-danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: rgba(255,107,107,.12); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-icon { padding: 7px; border-radius: var(--radius); }

/* ── Keyboard focus indicators (WCAG 2.4.7) ──────── */
.nav-item:focus-visible, .project-entry:focus-visible, .sidebar-logo:focus-visible,
.ws-breadcrumb a:focus-visible, .card-title:focus-visible, .card-cfg-link:focus-visible,
.modal-close:focus-visible, .ws-menu-btn:focus-visible, .section-head:focus-visible,
a:focus-visible {
  outline: 2px solid var(--amber); outline-offset: 2px; border-radius: var(--radius);
}
.section-head:focus-visible { outline-offset: -2px; } /* inset, since the head sits flush in the card */

/* ── Touch targets (WCAG 2.5.8): enlarge small controls on touch devices only,
      so the dense desktop layout is preserved for mouse/pointer users. ── */
@media (pointer: coarse) {
  .card-cfg-link, .btn-sm, .filter-bar .btn { min-height: 44px; display: inline-flex; align-items: center; }
  .section-head { min-height: 44px; }
  .tag-remove, .modal-close { min-width: 44px; min-height: 44px; }
}
/* Sidebar items become real <a> elements — strip the default link affordances. */
a.nav-item, a.project-entry, a.sidebar-logo { text-decoration: none; color: inherit; }
a.project-entry, a.sidebar-logo { display: block; }

/* ── Main content area ───────────────────────────── */
.ws-body { flex: 1; overflow-y: auto; padding: 36px 48px 100px; }
.ws-body::-webkit-scrollbar { width: 6px; }
.ws-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.ws-title { font-family: 'Syne', sans-serif; font-size: 26px; font-weight: 800; letter-spacing: -.5px; color: #fff; margin-bottom: 6px; }
.ws-subtitle { font-size: 12.5px; color: var(--text-3); margin-bottom: 32px; font-family: 'IBM Plex Mono', monospace; }
.ws-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }

/* ── Loading ─────────────────────────────────────── */
.loading-screen { display: flex; align-items: center; justify-content: center; height: 100%; gap: 8px; }
.loading-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); animation: loadPulse 1.2s ease-in-out infinite; }
.loading-dot:nth-child(2) { animation-delay: .2s; }
.loading-dot:nth-child(3) { animation-delay: .4s; }
@keyframes loadPulse { 0%,80%,100% { transform: scale(.6); opacity: .3; } 40% { transform: scale(1); opacity: 1; } }

/* ── Section Cards ───────────────────────────────── */
.section-card { background: var(--panel); border: 1.5px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 20px; overflow: hidden; animation: fadeUp .25s ease both; }
@keyframes fadeUp { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
.section-card:nth-child(2) { animation-delay:.04s; }
.section-card:nth-child(3) { animation-delay:.08s; }
.section-card:nth-child(4) { animation-delay:.12s; }
.section-card:nth-child(5) { animation-delay:.16s; }
.section-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px 15px; background: var(--border); border-bottom: 1px solid var(--border); cursor: pointer; user-select: none; transition: background .15s; }
.section-head:hover { background: var(--panel-hover); }
.section-head-left { display: flex; align-items: center; gap: 12px; }
.section-badge { width: 4px; height: 22px; border-radius: 2px; background: var(--amber); box-shadow: 0 0 8px rgba(245,166,35,.5); }
.section-title { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700; color: #fff; }
.section-num { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--text-3); margin-top: 1px; }
.section-toggle { color: var(--text-2); font-size: 18px; transition: transform .2s; line-height: 1; }
.section-card.collapsed .section-toggle { transform: rotate(-90deg); }
.section-card.collapsed .section-body { display: none; }
.section-body { padding: 22px; background: rgba(21, 35, 56, 0.5); }

/* ── Field Grid ──────────────────────────────────── */
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 28px; }
.field-span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: #fff; display: flex; align-items: center; gap: 6px; }
.field-required { color: var(--amber); font-size: 13px; font-weight: 700; }
.field-hint { font-size: 11.5px; color: var(--text-3); font-family: 'IBM Plex Mono', monospace; margin-top: -2px; }
.field input, .field textarea, .field select { background: var(--input-bg); border: 1.5px solid var(--border-input); border-radius: var(--radius); color: #fff; font-family: 'IBM Plex Sans', sans-serif; font-size: 14px; padding: 10px 14px; outline: none; transition: border-color .15s, box-shadow .15s; width: 100%; }
.field input::placeholder, .field textarea::placeholder { color: var(--text-3); }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--amber); border-width: 2px; box-shadow: 0 0 0 3px var(--amber-glow); }
.field input.field-invalid, .field textarea.field-invalid { border-color: var(--red) !important; border-width: 2px !important; box-shadow: 0 0 0 3px rgba(255,107,107,.18) !important; }
@keyframes fieldShake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-5px)} 40%{transform:translateX(5px)} 60%{transform:translateX(-4px)} 80%{transform:translateX(4px)} }
.field input.field-invalid, .field textarea.field-invalid { animation: fieldShake .35s ease; }
.field textarea { resize: vertical; min-height: 72px; line-height: 1.6; }
.field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238AAFC8' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; cursor: pointer; }
.field select option { background: var(--panel); color: #fff; }

/* Standalone field-input (outside .field wrapper) */
input.field-input, select.field-input, textarea.field-input { background: var(--input-bg); border: 1.5px solid var(--border-input); border-radius: var(--radius); color: #fff; font-family: 'IBM Plex Sans', sans-serif; font-size: 14px; padding: 10px 14px; outline: none; transition: border-color .15s, box-shadow .15s; }
input.field-input::placeholder, textarea.field-input::placeholder { color: var(--text-3); }
input.field-input:focus, select.field-input:focus, textarea.field-input:focus { border-color: var(--amber); border-width: 2px; box-shadow: 0 0 0 3px var(--amber-glow); }
select.field-input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238AAFC8' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; cursor: pointer; }
select.field-input option { background: var(--panel); color: #fff; }

/* ── Tag Input ───────────────────────────────────── */
.tag-input-wrap { background: var(--input-bg); border: 1.5px solid var(--border-input); border-radius: var(--radius); padding: 7px 10px; display: flex; flex-wrap: wrap; gap: 7px; align-items: center; cursor: text; min-height: 44px; transition: border-color .15s, box-shadow .15s; }
.tag-input-wrap:focus-within { border-color: var(--amber); border-width: 2px; box-shadow: 0 0 0 3px var(--amber-glow); }
.tag { display: inline-flex; align-items: center; gap: 5px; background: rgba(245,166,35,.15); border: 1.5px solid rgba(245,166,35,.45); border-radius: 4px; padding: 3px 8px 3px 10px; font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; font-weight: 500; color: var(--amber); }
.tag-remove { cursor: pointer; color: var(--amber-dim); font-size: 14px; line-height: 1; padding: 0 1px; transition: color .1s; border: none; background: transparent; }
.tag-remove:hover { color: #fff; }
.tag-input-wrap input { background: transparent; border: none; outline: none; color: #fff; font-family: 'IBM Plex Sans', sans-serif; font-size: 13.5px; min-width: 100px; flex: 1; padding: 2px; }
.tag-input-wrap input::placeholder { color: var(--text-3); }

/* ── Row slide-in animation (used by ID rows) ──────── */
@keyframes slideIn { from { opacity:0; transform:translateX(-6px); } to { opacity:1; transform:translateX(0); } }

/* ── ID rows ─────────────────────────────────────── */
.id-row { display: grid; grid-template-columns: 1fr 1fr 42px; gap: 8px; align-items: center; margin-bottom: 8px; animation: slideIn .2s ease both; }
.id-input { background: var(--input-bg); border: 1.5px solid var(--border-input); border-radius: var(--radius); color: #fff; font-family: 'IBM Plex Sans', sans-serif; font-size: 13.5px; padding: 10px 13px; outline: none; width: 100%; transition: border-color .15s, box-shadow .15s; }
.id-input:focus { border-color: var(--amber); border-width: 2px; box-shadow: 0 0 0 3px var(--amber-glow); }
.id-input::placeholder { color: var(--text-3); }

/* ── Info Banner ─────────────────────────────────── */
.info-banner { display: flex; align-items: flex-start; gap: 12px; background: rgba(30,216,238,.08); border: 1.5px solid rgba(30,216,238,.35); border-radius: var(--radius); padding: 13px 16px; margin-bottom: 20px; font-size: 13px; color: #7EEAF6; line-height: 1.6; }
.info-banner svg { flex-shrink: 0; margin-top: 1px; }

/* ── Save Bar ────────────────────────────────────── */
.save-bar { position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 0 48px; height: 58px; background: rgba(9,17,28,.97); border-top: 1.5px solid var(--border); backdrop-filter: blur(8px); }
.section-card > .save-bar { position: static; padding: 0 22px; }
.save-bar-status { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.status-dot.unsaved { background: var(--amber); }
.status-dot.saved { background: var(--green); box-shadow: 0 0 6px var(--green); }
.pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.3; } }

/* ── Project List Cards ──────────────────────────── */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.project-card { position: relative; background: var(--panel); border: 1.5px solid var(--border); border-radius: var(--radius-lg); padding: 20px; cursor: pointer; transition: border-color .15s, transform .15s; animation: fadeUp .25s ease both; display: flex; flex-direction: column; }
.project-card:hover { border-color: var(--amber); transform: translateY(-2px); }
/* Whole-card click: the title link is stretched to cover the card (block-link pattern).
   It stays a single real <a>, so screen readers announce one link and the SPA router works. */
.project-card .card-title::after { content: ''; position: absolute; inset: 0; border-radius: var(--radius-lg); }
.project-card:focus-within { border-color: var(--amber); box-shadow: 0 0 0 2px var(--amber-glow); }
.project-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.project-card-name { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; color: #fff; }
.project-card-cat { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; background: var(--amber-glow); border: 1px solid rgba(245,166,35,.3); border-radius: 3px; padding: 2px 8px; color: var(--amber); font-weight: 600; }
.project-card-beneficiar { font-size: 12.5px; color: var(--text-2); margin-bottom: 4px; }
.project-card-location { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--text-3); margin-bottom: 16px; }
.project-card-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 14px; border-top: 1px solid var(--border-dim); }
.project-card-count { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--text-3); }
.project-card-count strong { color: var(--text-2); font-size: 14px; }
.project-card-actions { display: flex; gap: 6px; }

/* ── Document Table ──────────────────────────────── */
.doc-table { width: 100%; border-collapse: collapse; }
.doc-table thead { position: sticky; top: 0; z-index: 2; background: var(--panel); }
.doc-table th { font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); text-align: left; padding: 8px 14px; border-bottom: 1.5px solid var(--border); white-space: nowrap; }
.doc-table td { padding: 11px 14px; border-bottom: 1px solid var(--border-dim); vertical-align: middle; font-size: 13.5px; color: var(--text-2); }
.doc-table tr:last-child td { border-bottom: none; }
.doc-table tr:hover td { background: var(--panel-hover); }
.doc-table td.td-primary { color: #fff; font-weight: 500; }
.pvr-badge { display: inline-block; font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; font-weight: 600; padding: 3px 9px; border-radius: 3px; }
.pvr-badge.pvt  { background: rgba(245,166,35,.15); border: 1px solid rgba(245,166,35,.4); color: var(--amber); }
.pvr-badge.pvla { background: rgba(30,216,238,.1); border: 1px solid rgba(30,216,238,.35); color: var(--teal); }
.pvr-badge.pvm  { background: rgba(52,211,153,.1); border: 1px solid rgba(52,211,153,.35); color: var(--green); }
.pvr-badge.pv_aparatura { background: rgba(168,85,247,.1); border: 1px solid rgba(168,85,247,.35); color: #c084fc; }
.pvr-badge.pv_hol { background: rgba(251,113,133,.1); border: 1px solid rgba(251,113,133,.35); color: #fb7185; }
.id-chips { display: flex; gap: 5px; flex-wrap: wrap; }
.id-chip { font-family: 'IBM Plex Mono', monospace; font-size: 11px; background: var(--panel-head); border: 1px solid var(--border-dim); border-radius: 3px; padding: 1px 7px; color: var(--text-2); white-space: nowrap; }

/* ── Filter bar ──────────────────────────────────── */
.filter-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 20px; }
.filter-controls { display: flex; gap: 10px; flex: 4; min-width: 0; }
.filter-bar .btn { flex: 1; white-space: nowrap; }
.filter-select { flex: 1; background: var(--input-bg); border: 1.5px solid var(--border-input); border-radius: var(--radius); color: #fff; font-family: 'IBM Plex Sans', sans-serif; font-size: 13px; padding: 7px 32px 7px 12px; outline: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238AAFC8' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; cursor: pointer; transition: border-color .15s; }
.filter-select:focus { border-color: var(--amber); }
.filter-select.has-value { border-color: var(--amber); color: var(--amber); }
.filter-select option { background: var(--panel); }
.filter-input { background: var(--input-bg); border: 1.5px solid var(--border-input); border-radius: var(--radius); color: #fff; font-family: 'IBM Plex Sans', sans-serif; font-size: 13px; padding: 7px 12px; outline: none; transition: border-color .15s; }
.filter-input:focus { border-color: var(--amber); }
.filter-input::placeholder { color: var(--text-3); }

/* ── Empty state ─────────────────────────────────── */
.empty-state { text-align: center; padding: 64px 32px; color: var(--text-3); }
.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: .5; }
.empty-state h3 { font-family: 'Syne', sans-serif; font-size: 18px; color: var(--text-2); margin-bottom: 8px; }
.empty-state p { font-size: 13.5px; max-width: 380px; margin: 0 auto 24px; line-height: 1.6; }

/* ── Toast ───────────────────────────────────────── */
.toast { position: fixed; bottom: 72px; right: 28px; background: var(--panel-head); border: 1.5px solid var(--border); border-left: 4px solid var(--amber); border-radius: var(--radius); padding: 13px 18px; font-size: 13.5px; font-weight: 500; color: #fff; box-shadow: 0 8px 32px rgba(0,0,0,.6); transform: translateX(140%); transition: transform .3s cubic-bezier(.34,1.56,.64,1); z-index: 200; display: flex; align-items: center; gap: 10px; min-width: 260px; }
.toast.show { transform: translateX(0); }
.toast.error { border-left-color: var(--red); }
.toast.error #toast-icon { stroke: var(--red); }

/* ── Modal ───────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 100; display: none; align-items: center; justify-content: center; padding: 24px; }
.modal-overlay.open { display: flex; }
/* Cap the modal to the viewport and scroll its body, so tall forms stay usable
   (header + footer pinned, content scrolls) instead of overflowing off-screen. */
.modal { background: var(--panel); border: 1.5px solid var(--border); border-radius: var(--radius-lg); width: 100%; max-width: 720px; max-height: calc(100vh - 48px); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.7); animation: fadeUp .2s ease; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 16px; border-bottom: 1px solid var(--border-dim); flex-shrink: 0; }
.modal-title { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; color: #fff; }
.modal-close { background: transparent; border: none; color: var(--text-3); font-size: 22px; cursor: pointer; line-height: 1; padding: 0 4px; transition: color .15s; }
.modal-close:hover { color: #fff; }
.modal-body { padding: 20px 22px; font-size: 14px; color: var(--text-2); line-height: 1.6; overflow-y: auto; }
.modal-footer { padding: 14px 22px 18px; display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--border-dim); flex-shrink: 0; }
/* The person modal (settings) has no .modal-body wrapper — let the whole modal scroll. */
.modal-overlay-open .modal { overflow-y: auto; }

/* ── Document view ───────────────────────────────── */
.doc-view { background: var(--panel); border: 1.5px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.doc-view-header { background: var(--panel-head); padding: 20px 24px; border-bottom: 1px solid var(--border); }
.doc-view-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.doc-view-field { padding: 12px 24px; border-bottom: 1px solid var(--border-dim); }
.doc-view-field:nth-child(odd) { border-right: 1px solid var(--border-dim); }
.doc-view-label { font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); margin-bottom: 4px; }
.doc-view-value { font-size: 14px; color: #fff; font-weight: 500; }

/* ── Misc ────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; padding: 2px 8px; border-radius: 3px; font-weight: 600; }
.badge-amber { background: var(--amber-glow); border: 1px solid rgba(245,166,35,.3); color: var(--amber); }
.badge-teal  { background: rgba(30,216,238,.1); border: 1px solid rgba(30,216,238,.3); color: var(--teal); }
.badge-green { background: rgba(52,211,153,.1); border: 1px solid rgba(52,211,153,.3); color: var(--green); }
.divider { height: 1px; background: var(--border-dim); margin: 20px 0; }
.text-muted { color: var(--text-3); }
.text-sm { font-size: 12px; }
.mono { font-family: 'IBM Plex Mono', monospace; }

/* ── App.js runtime classes ──────────────────────── */

/* Sidebar */
.sidebar-user { padding: 10px 14px 12px; border-bottom: 1px solid var(--border-dim); flex-shrink: 0; display: flex; flex-direction: column; gap: 4px; }
.sidebar-user-email { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-role { font-family: 'IBM Plex Mono', monospace; font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 3px; text-transform: uppercase; align-self: flex-start; }
.role-admin  { background: rgba(245,166,35,.15); border: 1px solid rgba(245,166,35,.35); color: var(--amber); }
.role-writer { background: rgba(52,211,153,.1);  border: 1px solid rgba(52,211,153,.3);  color: var(--green); }
.role-viewer { background: var(--panel-head); border: 1px solid var(--border-dim); color: var(--text-3); }

/* Breadcrumb aliases */
.bc-sep { color: var(--border); font-family: 'IBM Plex Mono', monospace; font-size: 11px; }
.bc-link { color: var(--text-2); text-decoration: none; font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; }
.bc-link:hover { color: #fff; }
.bc-current { color: #fff; font-family: 'IBM Plex Sans', sans-serif; font-size: 13px; font-weight: 600; }

/* Standalone input */
.input { background: var(--input-bg); border: 1.5px solid var(--border-input); border-radius: var(--radius); color: #fff; font-family: 'IBM Plex Sans', sans-serif; font-size: 14px; padding: 10px 14px; outline: none; transition: border-color .15s, box-shadow .15s; width: 100%; }
.input:focus { border-color: var(--amber); border-width: 2px; box-shadow: 0 0 0 3px var(--amber-glow); }
.input::placeholder { color: var(--text-3); }
textarea.input { resize: vertical; min-height: 72px; line-height: 1.6; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238AAFC8' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; cursor: pointer; }
select.input option { background: var(--panel); }

/* Custom date picker */
.dp-wrap { position: relative; width: 100%; }
.dp-display { background: var(--input-bg); border: 1.5px solid var(--border-input); border-radius: var(--radius); color: #fff; font-family: 'IBM Plex Sans', sans-serif; font-size: 15px; padding: 12px 40px 12px 14px; outline: none; transition: border-color .15s, box-shadow .15s; width: 100%; cursor: pointer; text-align: left; box-sizing: border-box; min-height: 48px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 18 18' fill='none'%3E%3Crect x='1' y='3' width='16' height='14' rx='2' stroke='%23F5A623' stroke-width='1.5'/%3E%3Cline x1='1' y1='7' x2='17' y2='7' stroke='%23F5A623' stroke-width='1.5'/%3E%3Cline x1='5' y1='1' x2='5' y2='5' stroke='%23F5A623' stroke-width='1.5' stroke-linecap='round'/%3E%3Cline x1='13' y1='1' x2='13' y2='5' stroke='%23F5A623' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px 18px; }
.dp-display.empty { color: var(--text-3); }
.dp-wrap.open .dp-display { border-color: var(--amber); border-width: 2px; box-shadow: 0 0 0 3px var(--amber-glow); }
.dp-popup { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--panel-head); border: 1.5px solid var(--border-input); border-radius: var(--radius-lg); padding: 16px; z-index: 200; box-shadow: 0 8px 32px rgba(0,0,0,.45); display: none; animation: fadeUp .15s ease both; }
.dp-wrap.open .dp-popup { display: block; }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.dp-nav { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border: 1px solid rgba(245,166,35,.25); background: var(--amber-glow); color: var(--amber); border-radius: var(--radius); cursor: pointer; transition: background .15s; font-size: 15px; padding: 0; }
.dp-nav:hover { background: rgba(245,166,35,.28); }
.dp-month-lbl { font-family: 'IBM Plex Sans', sans-serif; font-size: 15px; font-weight: 600; color: #fff; letter-spacing: .02em; }
.dp-dow { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 4px; }
.dp-dow-c { font-family: 'IBM Plex Mono', monospace; font-size: 9px; font-weight: 500; letter-spacing: .1em; color: var(--text-3); text-transform: uppercase; text-align: center; padding: 4px 0 8px; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-day { height: 32px; display: flex; align-items: center; justify-content: center; font-family: 'IBM Plex Sans', sans-serif; font-size: 13px; color: var(--text-2); border-radius: var(--radius); cursor: pointer; transition: all .12s; border: 1px solid transparent; background: none; width: 100%; padding: 0; }
.dp-day:hover:not([disabled]):not(.dp-empty) { border-color: rgba(245,166,35,.25); color: #fff; background: var(--amber-glow); }
.dp-day.dp-today { border-color: rgba(245,166,35,.4); color: #fff; }
.dp-day.dp-sel { background: var(--amber); border-color: var(--amber); color: #0D1B2E; font-weight: 600; }
.dp-day[disabled] { color: rgba(255,255,255,.15); cursor: not-allowed; }
.dp-day.dp-empty { visibility: hidden; cursor: default; pointer-events: none; }

/* Config form layout */
#main { flex: 1; overflow-y: auto; padding: 28px 40px; }
#main::-webkit-scrollbar { width: 6px; }
#main::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.config-form { padding: 0; width: 100%; }
.config-section { background: var(--panel); border: 1.5px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 20px; overflow: hidden; padding: 20px 24px; animation: fadeUp .2s ease both; }
.config-section .section-title { font-family: 'Syne', sans-serif; font-size: 14px; font-weight: 700; color: #fff; margin-bottom: 16px; border-bottom: 1px solid var(--border-dim); padding-bottom: 10px; }
.field-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field-row:last-child { margin-bottom: 0; }
.field-label { font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.section-hint { font-size: 12px; color: var(--text-3); font-style: italic; margin-bottom: 14px; }

/* Tag input (config form variant) */
.tag-wrap { background: var(--input-bg); border: 1.5px solid var(--border-input); border-radius: var(--radius); display: flex; flex-direction: column; transition: border-color .15s, box-shadow .15s; overflow: hidden; position: relative; }
.tag-wrap:focus-within { border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-glow); }
.tag-list { display: none; flex-wrap: wrap; gap: 8px; padding: 10px 12px 10px; border-bottom: 1px solid var(--border-input); }
.tag-input { background: transparent; border: none; outline: none; color: #fff; font-family: 'IBM Plex Sans', sans-serif; font-size: 13.5px; width: 100%; padding: 11px 12px; min-height: 42px; }
.tag-input::placeholder { color: var(--text-3); }

/* Suggestions dropdown */
.suggest-dropdown { position: absolute; z-index: 50; background: var(--panel-head); border: 1.5px solid var(--border-input); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.5); display: none; max-height: 340px; overflow-y: auto; }
.suggest-item { padding: 11px 16px; font-size: 13px; color: var(--text-2); cursor: pointer; transition: background .1s; white-space: normal; line-height: 1.4; }
.suggest-item:hover, .suggest-item.active { background: var(--amber-glow); color: var(--amber); }

/* dropdown anchors to tag-wrap */

/* ID element builder inputs */
.id-field-name, .id-field-desc { background: var(--input-bg); border: 1.5px solid var(--border-input); border-radius: var(--radius); color: #fff; font-family: 'IBM Plex Sans', sans-serif; font-size: 13.5px; padding: 9px 12px; outline: none; transition: border-color .15s; width: 100%; }
.id-field-name:focus, .id-field-desc:focus { border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-glow); }
.id-field-name::placeholder, .id-field-desc::placeholder { color: var(--text-3); }

/* btn-secondary alias for btn-ghost */
.btn-secondary { background: transparent; border: 1.5px solid var(--border); color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px; border-radius: var(--radius); font-family: 'IBM Plex Sans', sans-serif; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; line-height: 1; }
.btn-secondary:hover { background: var(--panel); color: #fff; border-color: var(--border-input); }
.btn-secondary:disabled { opacity: .5; pointer-events: none; }

/* Project grid cards (app.js class names) */
.card-header { margin-bottom: 10px; display: flex; align-items: center; }
.card-title { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; color: #fff; text-decoration: none; }
.card-title:hover { color: var(--amber); }
.card-meta { display: flex; flex-direction: column; gap: 3px; margin-bottom: 14px; }
.meta-item { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-foot { display: flex; align-items: center; justify-content: space-between; padding-top: 14px; border-top: 1px solid var(--border-dim); margin-top: auto; }
.doc-count { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--text-3); }
/* Sits above the stretched title link so "Configurare" stays independently clickable. */
.card-cfg-link { position: relative; z-index: 1; font-size: 12px; color: var(--text-3); text-decoration: none; padding: 4px 10px; border: 1px solid var(--border-dim); border-radius: var(--radius); transition: color .15s, border-color .15s; }
.card-cfg-link:hover { color: var(--amber); border-color: rgba(245,166,35,.4); }

/* Table wrapper */
.table-wrap { background: var(--panel); border: 1.5px solid var(--border); border-radius: var(--radius-lg); overflow: auto; max-height: calc(100vh - 260px); }
.doc-actions { display: flex; gap: 6px; white-space: nowrap; }

/* Pagination */
.pager { display: flex; gap: 6px; margin-top: 20px; flex-wrap: wrap; }
.pager .btn-secondary.active { background: var(--amber-glow); border-color: var(--amber); color: var(--amber); }

/* Modal actions */
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.warning-text { color: var(--red); font-size: 13px; margin-top: 6px; }

/* Empty state (app.js names) */
.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: .6; text-align: center; }
.empty-text { font-size: 14px; color: var(--text-3); text-align: center; max-width: 380px; margin: 0 auto 24px; line-height: 1.6; }

/* Error text */
.error-text { color: var(--red); font-size: 13.5px; padding: 12px 0; }

/* Toast error (app.js applies .toast-error class directly) */
.toast.toast-error { border-left-color: var(--red); }
.toast.toast-error #toast-icon { display: none; }

/* ── Package view ──────────────────────────────────────────── */
.pkg-toggle-btn { margin-left: auto; }
.pkg-view-title { font-family: 'Syne', sans-serif; font-size: 13px; font-weight: 700; color: var(--text-2); margin-left: 10px; align-self: center; }
.pkg-count { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--text-3); background: var(--border-dim); padding: 2px 7px; border-radius: 3px; margin-right: 6px; }
.pkg-comp { display: flex; align-items: center; gap: 8px; }
.pkg-comp-bar { width: 64px; height: 5px; background: var(--border-dim); border-radius: 3px; overflow: hidden; }
.pkg-comp-fill { height: 100%; background: var(--amber); border-radius: 3px; transition: width .3s; }
.pkg-comp-fill.pkg-comp-full { background: var(--green); }
.pkg-comp-label { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--text-3); white-space: nowrap; }
.pkg-summary { margin-top: 14px; font-size: 12px; font-family: 'IBM Plex Mono', monospace; color: var(--text-3); text-align: right; letter-spacing: .05em; }

/* Save bar actions group */
.save-bar-actions { display: flex; align-items: center; gap: 10px; }

/* Nav settings link — sits below project list */
.nav-settings-link { margin-top: 8px; border-top: 1px solid var(--border-dim); padding-top: 10px !important; }
.nav-link.active { background: var(--amber-glow); color: var(--amber); border: 1px solid rgba(245,166,35,.25); border-radius: var(--radius); }

/* Settings page */
.settings-page { padding-top: 4px; }
.settings-value { background: var(--input-bg); border: 1.5px solid var(--border-input); border-radius: var(--radius); color: var(--text-2); font-family: 'IBM Plex Mono', monospace; font-size: 13px; padding: 10px 14px; margin-top: 2px; }

/* Settings navigation */
.settings-nav { display: flex; gap: 2px; padding-bottom: 20px; margin-bottom: 4px; border-bottom: 1px solid var(--border-dim); flex-wrap: wrap; }
.settings-nav-item { display: inline-block; padding: 7px 16px; font-size: 13px; font-weight: 500; color: var(--text-2); text-decoration: none; border-radius: var(--radius); border: 1px solid transparent; transition: background .15s, color .15s, border-color .15s; }
.settings-nav-item:hover { background: var(--panel-hover); color: var(--text-1); }
.settings-nav-item.active { background: var(--amber-glow); color: var(--amber); border-color: rgba(245,166,35,.25); }

/* Settings sub-pages */
.settings-subpage { padding-top: 4px; }
.settings-subpage-desc { font-size: 13px; color: var(--text-3); margin-bottom: 20px; line-height: 1.6; }
.settings-subpage-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.people-table-wrap { margin-top: 4px; }

/* Users management */
.users-add-card { background: var(--panel); border: 1.5px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; margin-bottom: 20px; }
.users-add-row { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.users-add-row .field-input { flex: 1; min-width: 180px; }
.settings-subpage-toolbar .field-input { flex: 1; max-width: 360px; }
.users-table-wrap { margin-top: 4px; }
.users-row { grid-template-columns: 2.5fr 1.4fr 1.2fr 100px !important; }
.users-email { font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; color: var(--text-2); }
.users-role-select { background: var(--input-bg); border: 1px solid var(--border-input); border-radius: var(--radius); color: var(--text-2); font-size: 12.5px; padding: 5px 8px; cursor: pointer; width: 100%; }
.sug-group { margin-bottom: 24px; }
.sug-group:last-child { margin-bottom: 0; }
.sug-divider { height: 1px; background: var(--border-dim); margin: 20px 0; }
.sug-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.sug-item { display: flex; align-items: center; justify-content: space-between; background: var(--input-bg); border: 1px solid var(--border-dim); border-radius: var(--radius); padding: 8px 12px; gap: 10px; }
.sug-text { font-size: 13px; color: var(--text-2); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sug-empty { font-size: 12.5px; color: var(--text-3); font-style: italic; padding: 6px 0; }
.section-badge-red { background: var(--red); box-shadow: 0 0 8px rgba(255,107,107,.5); }

/* ── Custom tooltip ──────────────────────────────── */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel-head);
  color: var(--text-2);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  pointer-events: none;
  opacity: 0;
  transition: opacity .1s ease;
  z-index: 200;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}
[data-tip]:hover::after { opacity: 1; transition-delay: 80ms; }

/* Export modal */
.export-modal { display: flex; flex-direction: column; gap: 0; }
.export-section { padding: 14px 0; border-bottom: 1px solid var(--border-dim); }
.export-section:last-child { border-bottom: none; }
.export-section-label { font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--amber); margin-bottom: 4px; }
.export-section-hint { font-size: 12.5px; color: var(--text-3); margin-bottom: 10px; line-height: 1.5; }
.export-btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* People table */
.people-table { width: 100%; border-collapse: collapse; }
.people-row { display: grid; grid-template-columns: 2fr 1.5fr 1.5fr 1fr 200px; gap: 0; border-bottom: 1px solid var(--border-dim); width: 100%; }
.people-header .people-cell { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 8px 10px 10px; }
.people-cell { padding: 10px 10px; font-size: 13px; color: var(--text-2); display: flex; align-items: flex-start; flex-direction: column; gap: 2px; flex-wrap: wrap; }
.people-cell-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.people-actions { gap: 6px; flex-wrap: nowrap; justify-content: flex-end; flex-direction: row; align-items: center; }
.people-row:last-child { border-bottom: none; }
.people-row-default { background: rgba(245,166,35,.04); }
.people-name-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.people-default-badge { font-family: 'IBM Plex Mono', monospace; font-size: 9px; font-weight: 700; letter-spacing: .08em; padding: 2px 6px; border-radius: 3px; background: var(--amber-glow); border: 1px solid rgba(245,166,35,.35); color: var(--amber); flex-shrink: 0; }

/* Person modal (inline/dynamic — always open when in DOM) */
.modal-overlay-open { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-overlay-open .modal { padding: 24px 24px 20px; }
.modal-title { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; color: #fff; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.field:has(.roles-checkboxes) { padding-top: 20px; }
.roles-checkboxes { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.role-check-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.role-check-label input[type=checkbox] { accent-color: var(--amber); width: 15px; height: 15px; cursor: pointer; }
.default-toggle-section { margin-top: 20px; padding-top: 16px; border-top: 1.5px solid var(--border-dim); }
.default-toggle-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; background: var(--amber-glow2); border: 1px solid rgba(245,166,35,.22); border-radius: var(--radius); cursor: pointer; transition: background .15s, border-color .15s; }
.default-toggle-row:hover { background: var(--amber-glow); border-color: rgba(245,166,35,.4); }
.default-toggle-row input[type=checkbox] { accent-color: var(--amber); width: 16px; height: 16px; cursor: pointer; flex-shrink: 0; }
.default-toggle-text { display: flex; flex-direction: column; gap: 3px; }
.default-toggle-title { font-size: 13px; color: var(--text-1); font-weight: 500; }
.default-toggle-hint { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--amber-dim); }

/* ── New Project Wizard ─────────────────────────────── */
.wizard-wrap { max-width: 1100px; margin: 0 auto; padding: 48px 40px 80px; display: flex; flex-direction: column; gap: 40px; }

/* Step indicator */
.wizard-steps { display: flex; align-items: center; gap: 0; }
.wizard-step, .wizard-step.done, .wizard-step.active { display: flex; align-items: center; gap: 10px; padding: 6px 18px 6px 0; flex-shrink: 0; }
.wstep-num { width: 30px; height: 30px; border-radius: 50%; background: var(--panel); border: 1.5px solid var(--border); color: var(--text-3); font-family: 'IBM Plex Mono', monospace; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.wizard-step.active .wstep-num { background: var(--amber); border-color: var(--amber); color: #000; }
.wizard-step.done .wstep-num { background: var(--green); border-color: var(--green); color: #000; font-size: 14px; }
.wstep-label { font-size: 14px; color: var(--text-3); font-weight: 500; }
.wizard-step.active .wstep-label { color: var(--text-1); font-weight: 600; }
.wizard-step.done .wstep-label { color: var(--text-3); }
.wizard-connector { flex: 1; height: 1.5px; background: var(--border-dim); margin: 0 4px; min-width: 20px; }
.wizard-connector.done { background: var(--green); opacity: .5; }

/* Title block */
.wizard-title h2 { font-family: 'Syne', sans-serif; font-size: 28px; font-weight: 800; color: var(--text-1); margin-bottom: 8px; }
.wizard-subtitle { font-size: 15px; color: var(--text-2); line-height: 1.6; }

/* Type cards */
.type-group-label { font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--text-3); margin-bottom: -20px; }
.type-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
@media (max-width: 700px) { .type-cards { grid-template-columns: 1fr; } }
.type-card { background: var(--panel); border: 1.5px solid var(--border-dim); border-radius: var(--radius-lg); padding: 32px 28px 26px; cursor: pointer; transition: border-color .15s, background .15s, transform .1s; display: flex; flex-direction: column; gap: 16px; }
.type-card:hover { border-color: var(--amber); background: var(--panel-hover); transform: translateY(-2px); }
.type-card-icon { width: 56px; height: 56px; border-radius: 12px; background: var(--amber-glow2); border: 1px solid rgba(245,166,35,.2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.type-card-icon svg { width: 28px; height: 28px; color: var(--amber); }
.type-card-label { font-family: 'Syne', sans-serif; font-size: 17px; font-weight: 700; color: var(--text-1); }
.type-card-sub { font-size: 13.5px; color: var(--text-3); line-height: 1.55; flex: 1; }
.type-card-norms { display: flex; flex-wrap: wrap; gap: 6px; }
.norm-chip { background: var(--input-bg); border: 1px solid var(--border-dim); border-radius: 3px; padding: 3px 9px; font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--text-3); white-space: nowrap; }

/* Upload zone */
.upload-zone { border: 2px dashed var(--border); border-radius: var(--radius-lg); padding: 48px 24px; display: flex; flex-direction: column; align-items: center; gap: 14px; background: var(--surface); transition: border-color .2s, background .2s; text-align: center; }
.upload-zone.drag-over { border-color: var(--amber); background: var(--amber-glow2); }
.upload-zone.loading { opacity: .7; pointer-events: none; }
.upload-icon svg { width: 40px; height: 40px; color: var(--amber); opacity: .7; }
.upload-label { font-size: 14px; color: var(--text-2); }
.upload-hint { font-size: 12px; color: var(--text-3); font-family: 'IBM Plex Mono', monospace; }
.wizard-skip { text-align: center; font-size: 13px; }
.wizard-skip a { color: var(--text-3); text-decoration: underline; text-underline-offset: 3px; }
.wizard-skip a:hover { color: var(--text-2); }
.wizard-back { margin-top: -10px; align-self: flex-start; }

/* Parse preview */
.parse-preview { background: var(--panel); border: 1.5px solid var(--border-dim); border-radius: var(--radius-lg); padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.parse-preview-head { display: flex; align-items: flex-start; gap: 14px; }
.parse-ok-icon { width: 28px; height: 28px; border-radius: 50%; background: rgba(52,211,153,.15); border: 1.5px solid var(--green); color: var(--green); font-size: 13px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px; }
.parse-filename { font-size: 13.5px; font-weight: 600; color: var(--text-1); }
.parse-caption { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.parse-field-grid { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; }
.parse-field-label { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; display: flex; align-items: center; }
.parse-field-value { font-size: 13px; color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.parse-norm-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.parse-norm-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.parse-empty { font-size: 13px; color: var(--text-3); font-style: italic; }

/* ── Multi-file import queue ───────────────────────────────────── */
.import-queue { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; max-height: 480px; overflow-y: auto; }
.import-file-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--border-dim); background: var(--surface); transition: border-color .15s; }
.import-file-pending  { opacity: .65; }
.import-file-processing { border-color: var(--amber); background: var(--amber-glow2); }
.import-file-done     { border-color: var(--border-dim); }
.import-file-error    { border-color: #c0392b44; background: #c0392b0a; }
.import-file-status   { width: 22px; height: 22px; min-width: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; background: var(--input-bg); color: var(--text-3); }
.import-file-done .import-file-status     { background: #16a34a22; color: #16a34a; }
.import-file-error .import-file-status    { background: #c0392b22; color: #c0392b; }
.import-file-processing .import-file-status { background: var(--amber-glow2); color: var(--amber); }
.import-file-status.spinning::after { content: ''; display: block; width: 13px; height: 13px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.import-file-info   { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.import-file-name   { font-size: 13px; font-weight: 500; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.import-file-cat    { font-size: 11px; color: var(--text-3); }
.import-file-summary { font-size: 11px; color: var(--amber); }
.import-file-err    { color: #c0392b; }

/* ── Progress bar ───────────────────────────────────────────────── */
.import-progress    { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.progress-bar       { height: 6px; border-radius: 99px; background: var(--border-dim); overflow: hidden; }
.progress-fill      { height: 100%; border-radius: 99px; background: var(--amber); transition: width .3s ease; }
.progress-label     { font-size: 12px; color: var(--text-3); text-align: right; }

/* ── Import action row ──────────────────────────────────────────── */
.import-actions     { display: flex; align-items: center; gap: 16px; margin-top: 20px; flex-wrap: wrap; }
.import-merged-preview { background: var(--panel); border: 1.5px solid var(--border-dim); border-radius: var(--radius-lg); padding: 20px; display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }
.wizard-skip-link   { font-size: 13px; color: var(--text-3); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.wizard-skip-link:hover { color: var(--text-2); }

/* Bransament wizard sections */
.brans-section { background: var(--panel); border: 1.5px solid var(--border-dim); border-radius: var(--radius-lg); padding: 24px 28px; display: flex; flex-direction: column; gap: 16px; }
.brans-section-title { font-family: 'Syne', sans-serif; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--amber); margin-bottom: 4px; }
.inherited-notice { display: flex; align-items: center; gap: 10px; background: rgba(56,189,248,.08); border: 1.5px solid rgba(56,189,248,.25); border-radius: var(--radius); padding: 10px 14px; font-size: 12.5px; color: #7DD3FC; margin-bottom: 4px; }
.inherited-notice strong { color: #BAE6FD; }
input.field-input.input-inherited { border-color: rgba(56,189,248,.5); background: rgba(56,189,248,.06); }
input.field-input.input-inherited:focus { border-color: #38BDF8; box-shadow: 0 0 0 3px rgba(56,189,248,.18); }


.btn-ghost { background: transparent; border: 1.5px solid var(--border-dim); color: var(--text-3); padding: 7px 14px; border-radius: var(--radius); font-size: 13px; cursor: pointer; transition: border-color .15s, color .15s; }
.btn-ghost:hover { border-color: var(--border); color: var(--text-2); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text-2); padding: 8px 16px; border-radius: var(--radius); font-size: 13px; cursor: pointer; transition: border-color .15s, color .15s; }
.btn-outline:hover { border-color: var(--amber); color: var(--amber); }


/* ── BoQ (Bill of Quantities) ───────────────────────────────────── */
.boq-section { margin-top: 28px; }
.boq-group { margin-bottom: 24px; }
.boq-cat-title { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin: 0 0 10px; }
.boq-table td { padding: 8px 12px; font-size: 13px; }
.boq-num-input { background: var(--input-bg); border: 1px solid var(--border-input); border-radius: 4px; color: #fff; font-size: 13px; padding: 4px 8px; width: 90px; outline: none; text-align: right; }
.boq-num-input:focus { border-color: var(--amber); }
.boq-num-input:disabled { opacity: .5; cursor: default; }
.boq-val { font-family: 'IBM Plex Mono', monospace; font-size: 13px; text-align: right; color: var(--text-2); }
.boq-total-label { color: var(--text-3); font-size: 12px; text-align: right; padding-right: 14px; }
.boq-total { color: var(--amber); font-weight: 600; font-size: 13px; }
.boq-grand-total-row { border-top: 1.5px solid var(--border); padding-top: 10px; margin-top: 4px; }
.boq-grand-total-row .field-label { font-weight: 600; }
.boq-grand-total-row strong { font-family: 'IBM Plex Mono', monospace; color: var(--amber); font-size: 15px; }

/* ── Demo project ─────────────────────────────────────────────── */
.demo-badge { font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; font-weight: 700; letter-spacing: .08em; padding: 2px 7px; border-radius: 3px; background: rgba(30,216,238,.12); border: 1px solid rgba(30,216,238,.35); color: var(--teal); margin-left: 8px; vertical-align: middle; flex-shrink: 0; }
.project-card-demo { border-color: rgba(30,216,238,.25); }
.project-card-demo:hover { border-color: var(--teal); }
.client-badge { font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; font-weight: 700; letter-spacing: .06em; padding: 2px 7px; border-radius: 3px; margin-left: 8px; vertical-align: middle; flex-shrink: 0; }
.client-badge-consumator { background: rgba(30,216,238,.1); border: 1px solid rgba(30,216,238,.3); color: var(--teal); }
.client-badge-prosumator { background: rgba(52,211,153,.12); border: 1px solid rgba(52,211,153,.35); color: var(--green); }
.project-info-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }

/* ── Registru ──────────────────────────────────────────────────── */
.registru-year-bar { display: flex; gap: 6px; padding: 20px 28px 0; flex-wrap: wrap; }
.year-tab { background: var(--panel); border: 1.5px solid var(--border-dim); color: var(--text-3); font-family: 'IBM Plex Mono', monospace; font-size: 13px; font-weight: 600; padding: 6px 18px; border-radius: var(--radius); cursor: pointer; transition: all .15s; }
.year-tab:hover { border-color: var(--border); color: var(--text-2); }
.year-tab.active { background: var(--amber-glow); border-color: rgba(245,166,35,.4); color: var(--amber); }

.registru-table-wrap { margin: 16px 28px; max-height: calc(100vh - 180px); }
.registru-table th { white-space: pre-line; line-height: 1.3; }
.registru-table td { vertical-align: top; }
.registru-nr { font-family: 'IBM Plex Mono', monospace; font-size: 14px; font-weight: 700; color: var(--amber); white-space: nowrap; }
.project-link { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--teal); text-decoration: none; display: inline-block; margin-top: 3px; }
.project-link:hover { text-decoration: underline; }
.continut-cell { max-width: 220px; white-space: pre-wrap; line-height: 1.5; font-size: 12.5px; }
.empty-cell { text-align: center; color: var(--text-3); font-size: 13px; padding: 40px 16px; }

.provine-badge { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; padding: 3px 9px; border-radius: 3px; display: inline-block; }
.provine-intern { background: rgba(52,211,153,.1); border: 1px solid rgba(52,211,153,.3); color: var(--green); }
.provine-extern { background: rgba(30,216,238,.1); border: 1px solid rgba(30,216,238,.3); color: var(--teal); }

.status-badge { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; padding: 3px 9px; border-radius: 3px; display: inline-block; }
.status-n-lucru  { background: rgba(251,191,36,.1);  border: 1px solid rgba(251,191,36,.3);  color: var(--accent); }
.status-finalizat { background: rgba(52,211,153,.1); border: 1px solid rgba(52,211,153,.3); color: var(--green); }
.status-clasat   { background: rgba(148,163,184,.1); border: 1px solid rgba(148,163,184,.3); color: var(--text-3); }

.row-actions { white-space: nowrap; }
.btn-edit  { background: transparent; border: 1px solid var(--border-dim); color: var(--text-3); padding: 4px 9px; border-radius: var(--radius); cursor: pointer; font-size: 13px; transition: all .15s; margin-right: 4px; }
.btn-edit:hover  { border-color: var(--amber); color: var(--amber); }
.btn-delete { background: transparent; border: 1px solid var(--border-dim); color: var(--text-3); padding: 4px 9px; border-radius: var(--radius); cursor: pointer; font-size: 15px; line-height: 1; transition: all .15s; }
.btn-delete:hover { border-color: var(--red); color: var(--red); }

.registru-form { display: flex; flex-direction: column; gap: 12px; }
.form-row { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.radio-group { display: flex; gap: 20px; padding: 10px 0; }
.radio-label { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--text-2); cursor: pointer; }
.radio-label input { accent-color: var(--amber); width: 15px; height: 15px; cursor: pointer; }
.registru-textarea { resize: vertical; min-height: 80px; }
.modal-btn-row { display: flex; gap: 10px; justify-content: flex-end; width: 100%; }

/* ════════════════════════════════════════════════════════════════════════════
   RESPONSIVE — desktop-first override layer
   Everything above is the known-good desktop layout (≥1024px). The blocks below
   only *subtract* from it at smaller widths, so desktop is never affected.
   ════════════════════════════════════════════════════════════════════════════ */

/* Mobile drawer affordances — hidden on desktop, revealed at ≤768px */
.ws-menu-btn { display: none; align-items: center; justify-content: center; width: 38px; height: 38px; flex-shrink: 0; padding: 0; background: transparent; border: 1.5px solid var(--border); border-radius: var(--radius); color: var(--text-2); cursor: pointer; transition: border-color .15s, color .15s; }
.ws-menu-btn:hover { border-color: var(--border-input); color: #fff; }
.ws-menu-btn svg { width: 18px; height: 18px; display: block; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 110; }

/* Mapper desktop-gate notice (rendered by dosar-mapper.js on small screens) */
.mapper-mobile-notice { max-width: 460px; margin: 48px auto; text-align: center; background: var(--panel); border: 1.5px solid var(--border); border-radius: var(--radius-lg); padding: 36px 28px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.mapper-mobile-notice .mmn-icon { font-size: 40px; opacity: .7; }
.mapper-mobile-notice h3 { font-family: 'Syne', sans-serif; font-size: 18px; color: #fff; }
.mapper-mobile-notice p { font-size: 13.5px; color: var(--text-3); line-height: 1.6; }

/* ── ≤1024px — small laptops / large tablets: trim gutters so nothing clips ── */
@media (max-width: 1024px) {
  .ws-body { padding: 28px 24px 80px; }
  #main { padding: 24px 24px; }
  .save-bar { padding: 0 24px; }
  .wizard-wrap { padding: 40px 24px 72px; }
  .registru-table-wrap { margin: 16px 20px; }
  .registru-year-bar { padding: 18px 20px 0; }
}

/* ── ≤768px — tablet portrait / phones: sidebar→drawer, single-column ── */
@media (max-width: 768px) {
  /* Shell collapses to one column; sidebar lifts out of the grid into a drawer */
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 280px; max-width: 85vw; z-index: 120;
    transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: 4px 0 28px rgba(0,0,0,.5);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; }

  /* Header: reveal hamburger, tighten padding */
  .ws-header { padding: 0 14px; gap: 12px; }
  .ws-menu-btn { display: inline-flex; }

  /* Forms / detail grids go single-column */
  .field-grid { grid-template-columns: 1fr; gap: 18px; }
  .field-span-2 { grid-column: auto; }
  .doc-view-grid { grid-template-columns: 1fr; }
  .doc-view-field:nth-child(odd) { border-right: none; }
  .parse-field-grid { grid-template-columns: 1fr; gap: 4px 0; }

  /* Toolbars / filters stack */
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-controls { flex-wrap: wrap; }
  .filter-bar .btn { flex: 1 1 auto; }

  /* Tables: keep tabular layout, scroll horizontally inside their wrappers */
  .table-wrap, .registru-table-wrap, .people-table-wrap, .users-table-wrap { overflow-x: auto; }
  .doc-table, .registru-table { min-width: 640px; }
  .people-row, .users-row { min-width: 620px; }

  /* Wizard breathing room */
  .wizard-wrap { gap: 28px; padding: 32px 18px 64px; }

  /* Mapper falls back to stacked layout if opened anyway */
  .mapper-twocol { flex-direction: column; }
  .mapper-sidepanel { width: 100% !important; flex-shrink: 1; }
}

/* ── ≤480px — phones: tighten padding, reflow dense rows ── */
@media (max-width: 480px) {
  .ws-body { padding: 16px 14px 72px; }
  #main { padding: 16px 14px; }
  .ws-title { font-size: 22px; }
  .section-body, .config-section { padding: 16px 16px; }

  /* Save bar wraps instead of overflowing */
  .save-bar { height: auto; min-height: 58px; padding: 10px 14px; flex-wrap: wrap; gap: 10px; }

  /* Variable rows: drop the fixed column header, let inputs wrap */
  .var-list-header { display: none; }
  .var-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .var-row .drag-handle { flex: 0 0 auto; }
  .var-row .var-input { flex: 1 1 140px; }
  .var-row .var-type-select { flex: 1 1 110px; }
  .var-row .var-delete { flex: 0 0 auto; margin-left: auto; }

  /* Toast spans the width instead of a fixed 260px min */
  .toast { left: 14px; right: 14px; bottom: 16px; min-width: 0; }

  /* Modal hugs the viewport */
  .modal-overlay, .modal-overlay-open { padding: 12px; }
  .modal { max-height: calc(100vh - 24px); } /* match the smaller overlay padding */

  .registru-table-wrap { margin: 12px 14px; }
  .registru-year-bar { padding: 16px 14px 0; }
}
