:root {
  --bg: #f5f7fa;
  --paper: #ffffff;
  --ink: #1a2433;
  --muted: rgba(26, 36, 51, 0.62);
  --soft: rgba(26, 36, 51, 0.4);
  --rule: rgba(26, 36, 51, 0.1);
  --rule-strong: rgba(26, 36, 51, 0.2);
  --primary: #1f4d8c;
  --primary-deep: #0e3160;
  --primary-hover: #173a6a;
  --gold: #c69531;
  --danger: #9c2a35;
  --success: #2e7d4f;
  --ff-body: 'IBM Plex Sans', system-ui, sans-serif;
  --ff-mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--ff-body);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* === Login screen === */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(180deg, #f5f7fa 0%, #e9eef4 100%);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--paper);
  border-radius: 8px;
  padding: 36px 32px;
  box-shadow: 0 10px 40px rgba(14, 49, 96, 0.1);
}
.login-card h1 {
  font-family: var(--ff-body);
  font-size: 22px;
  font-weight: 500;
  margin: 0 0 6px;
  color: var(--primary-deep);
}
.login-card p { color: var(--muted); font-size: 13px; margin: 0 0 28px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form label { display: flex; flex-direction: column; gap: 6px; }
.login-form span {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.login-form input {
  padding: 11px 14px;
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.login-form input:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31, 77, 140, 0.12);
}
.login-remember {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.login-remember input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}
.login-remember span {
  font-size: 13px !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  color: var(--muted) !important;
  margin: 0 !important;
}
.login-form button {
  margin-top: 6px;
  padding: 12px 16px;
  background: var(--primary);
  color: #fff;
  border: 0;
  border-radius: 4px;
  font-weight: 500;
  letter-spacing: 0.03em;
  transition: background 0.15s;
}
.login-form button:hover { background: var(--primary-hover); }
.login-error {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--danger);
  background: rgba(156, 42, 53, 0.06);
  border-left: 3px solid var(--danger);
  padding: 8px 12px;
  border-radius: 0 3px 3px 0;
}

/* === App shell === */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--primary-deep);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}
.sidebar-nav { overflow-y: auto; }
.sidebar-brand {
  padding: 22px 22px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.sidebar-brand b {
  font-size: 17px;
  font-weight: 600;
  display: block;
}
.sidebar-brand small {
  display: block;
  font-family: var(--ff-mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 4px;
}
.sidebar-nav { padding: 14px 0; flex: 1; }
.sidebar-nav button {
  width: 100%;
  background: transparent;
  border: 0;
  text-align: left;
  padding: 10px 22px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.12s, color 0.12s;
}
.sidebar-nav button:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.sidebar-nav button.on {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-weight: 500;
  border-left: 3px solid var(--gold);
  padding-left: 19px;
}
.sidebar-nav .count {
  background: rgba(255, 255, 255, 0.1);
  font-family: var(--ff-mono);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 3px;
}
.sidebar-nav button.hot {
  background: linear-gradient(90deg, rgba(198, 149, 49, 0.22), rgba(198, 149, 49, 0.06));
  color: #ffe9b3;
  border-left: 3px solid var(--gold);
  padding-left: 19px;
  animation: nav-hot-pulse 1.6s ease-in-out infinite;
}
.sidebar-nav button.hot .count {
  background: var(--gold);
  color: #1a1a1a;
  font-weight: 600;
  box-shadow: 0 0 0 0 rgba(198, 149, 49, 0.55);
  animation: nav-hot-count-pulse 1.6s ease-in-out infinite;
}
.sidebar-nav button.hot.on {
  animation: none;
  background: rgba(198, 149, 49, 0.18);
  color: #fff;
}
.sidebar-nav button.hot.on .count { animation: none; }
@keyframes nav-hot-pulse {
  0%, 100% { box-shadow: inset 3px 0 0 var(--gold), inset 0 0 0 rgba(198, 149, 49, 0); }
  50%      { box-shadow: inset 3px 0 0 var(--gold), inset 0 0 22px rgba(198, 149, 49, 0.25); }
}
@keyframes nav-hot-count-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(198, 149, 49, 0.55); }
  50%      { box-shadow: 0 0 0 6px rgba(198, 149, 49, 0); }
}
.sidebar-foot {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 16px 22px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.7);
}
.sidebar-foot b { display: block; color: #fff; font-weight: 500; }
.sidebar-foot button {
  margin-top: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 6px 12px;
  border-radius: 3px;
  font-size: 12px;
}
.sidebar-foot button:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

.main { padding: 28px 36px; overflow-x: auto; }
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 22px;
  gap: 16px;
}
.page-head h1 {
  font-size: 24px;
  font-weight: 500;
  margin: 0;
  color: var(--ink);
}
.page-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}
.btn {
  background: var(--primary);
  color: #fff;
  border: 0;
  padding: 9px 16px;
  border-radius: 3px;
  font-size: 13.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}
.btn:hover { background: var(--primary-hover); }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule-strong);
}
.btn.ghost:hover { background: var(--bg); border-color: var(--primary); color: var(--primary); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #7e1f29; }

/* === Tables === */
.table-card {
  background: var(--paper);
  border-radius: 6px;
  border: 1px solid var(--rule);
  overflow: hidden;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.data th, table.data td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
table.data thead th {
  background: var(--bg);
  font-family: var(--ff-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--rule-strong);
}
table.data tbody tr:hover { background: rgba(31, 77, 140, 0.03); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .row-title { font-weight: 500; color: var(--ink); }
table.data .row-meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
table.data .row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
table.data .row-actions button {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 12.5px;
}
table.data .row-actions button:hover { background: var(--bg); color: var(--primary); }
table.data .row-actions button.danger:hover { background: rgba(156, 42, 53, 0.08); color: var(--danger); }
.empty {
  padding: 50px 22px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}
.tag {
  display: inline-block;
  font-family: var(--ff-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 3px;
  font-weight: 600;
}
.tag.pub { background: rgba(46, 125, 79, 0.1); color: var(--success); }
.tag.draft { background: rgba(26, 36, 51, 0.08); color: var(--muted); }
.tag.gold { background: rgba(198, 149, 49, 0.1); color: var(--gold); border: 1px solid rgba(198, 149, 49, 0.3); }
.tag.role-admin { background: rgba(31, 77, 140, 0.1); color: var(--primary); }
.tag.role-user { background: rgba(26, 36, 51, 0.06); color: var(--muted); }
.tag.unread { background: rgba(156, 42, 53, 0.08); color: var(--danger); }

/* === Modal === */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(14, 49, 96, 0.45);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 100;
  animation: fade 0.15s;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--paper);
  border-radius: 6px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow: auto;
  padding: 24px 28px;
  box-shadow: 0 24px 64px rgba(14, 49, 96, 0.25);
}
.modal h2 {
  font-size: 18px;
  font-weight: 500;
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}
.modal-form { display: flex; flex-direction: column; gap: 14px; }
.modal-form label { display: flex; flex-direction: column; gap: 5px; }
.modal-form span {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.modal-form input,
.modal-form select,
.modal-form textarea {
  padding: 9px 12px;
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.modal-form input:focus,
.modal-form select:focus,
.modal-form textarea:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31, 77, 140, 0.12);
}
.modal-form textarea { resize: vertical; min-height: 100px; font-family: inherit; }
.modal-form .row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-form .row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.modal-form input[type='checkbox'] { width: auto; margin: 0; }
.modal-form .check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-direction: row !important;
  cursor: pointer;
}
.modal-form .check span { letter-spacing: 0.04em; text-transform: none; font-family: inherit; font-size: 13px; color: var(--ink); font-weight: 400; }
.modal-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}
.modal-error {
  font-size: 13px;
  color: var(--danger);
  background: rgba(156, 42, 53, 0.06);
  border-left: 3px solid var(--danger);
  padding: 8px 12px;
  border-radius: 0 3px 3px 0;
}

.loading {
  padding: 60px 22px;
  text-align: center;
  color: var(--muted);
  font-family: var(--ff-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.modal-label-small {
  display: block;
  font-family: var(--ff-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}
.detail-val {
  font-size: 14px;
  color: var(--ink);
  font-weight: 500;
}
.long-text {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
}

@media (max-width: 800px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    flex-direction: row;
    overflow-x: auto;
    padding: 6px;
  }
  .sidebar-brand, .sidebar-foot { display: none; }
  .sidebar-nav {
    display: flex;
    padding: 0;
    gap: 4px;
  }
  .sidebar-nav button {
    padding: 8px 14px;
    white-space: nowrap;
    border-left: 0 !important;
  }
  .sidebar-nav button.on {
    border-bottom: 3px solid var(--gold);
    padding-left: 14px;
  }
  .main { padding: 18px 16px; }
  .page-head { flex-direction: column; align-items: stretch; }
  table.data { font-size: 12.5px; }
  table.data th, table.data td { padding: 9px 10px; }
  .modal-form .row-2, .modal-form .row-3 { grid-template-columns: 1fr; }
}

/* ============================================================
   Site Images (Funcțional) — swap public site images
   ============================================================ */
.site-images { display: flex; flex-direction: column; gap: 36px; }
.si-group h2 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}
.si-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.si-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color .18s, box-shadow .18s, transform .15s;
}
.si-card:hover {
  border-color: var(--rule-strong);
  box-shadow: 0 6px 20px rgba(14, 49, 96, 0.06);
  transform: translateY(-1px);
}
.si-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #f3f5f9;
  overflow: hidden;
}
.si-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.si-body { padding: 12px 14px 6px; flex: 1; }
.si-label { font-weight: 600; font-size: 14px; color: var(--ink); margin-bottom: 4px; line-height: 1.3; }
.si-path { font-family: var(--ff-mono, ui-monospace, monospace); font-size: 11px; color: var(--muted); word-break: break-all; }
.si-actions { padding: 8px 14px 14px; }
.si-actions .btn { width: 100%; justify-content: center; padding: 8px 12px; font-size: 13px; }
.si-group-count { font-weight: 400; color: var(--muted); margin-left: 6px; }

/* ============================================================
   Service galleries section (under Funcțional)
   ============================================================ */
.sg-section { margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--rule-strong); }
.sg-section-head { margin-bottom: 24px; }
.sg-section-head h2 { font-size: 18px; font-weight: 600; margin: 0 0 6px; color: var(--ink); }
.sg-section-head p { color: var(--muted); font-size: 13.5px; max-width: 720px; margin: 0; line-height: 1.5; }

.sg-list { display: flex; flex-direction: column; gap: 20px; }
.sg-service {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 18px;
}
.sg-service-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.sg-service-head h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.sg-hint { font-family: var(--ff-mono, ui-monospace, monospace); font-size: 11.5px; color: var(--muted); letter-spacing: .02em; }
.sg-empty {
  padding: 24px;
  background: #f8fafc;
  border-radius: 6px;
  font-size: 13px;
  color: var(--muted);
}
.sg-empty code {
  background: rgba(0,0,0,0.05);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
}
.sg-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.sg-photo {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 5px;
  overflow: hidden;
  background: #f0f2f5;
}
.sg-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sg-photo-del {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 0;
  background: rgba(0,0,0,0.65);
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .15s;
}
.sg-photo-del:hover { background: rgba(220, 38, 38, 0.9); }

/* ============================================================
   Service gallery modal (opened from Funcțional → + button)
   ============================================================ */
.sg-modal { display: flex; flex-direction: column; gap: 16px; }
.sg-modal-lead { color: var(--muted); font-size: 13.5px; margin: 0; line-height: 1.5; }
.sg-modal-field { display: flex; flex-direction: column; gap: 6px; }
.sg-modal-field span { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.sg-modal-field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
}
.sg-modal-hint {
  background: #eef4fb;
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 12.5px;
  color: var(--primary-deep);
}
.sg-modal-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  min-height: 50px;
}

/* Jump-to-site arrows */
.si-jump {
  display: inline-block;
  margin-left: 10px;
  color: var(--primary);
  font-size: 18px;
  font-weight: 600;
  text-decoration: none;
  transition: transform .15s, color .15s;
  vertical-align: middle;
}
.si-jump:hover { color: var(--primary-deep); transform: translateX(3px); }

/* per-image card arrow removed by user request 2026-06-14 */

/* Jump button in row actions (open PDF on public site) */
.row-actions .jump-btn {
  background: transparent;
  color: var(--primary);
  border: 0;
  padding: 4px 8px;
  font-size: 16px;
  font-weight: 600;
}
.row-actions .jump-btn:hover {
  color: var(--primary-deep);
  background: transparent;
}

/* Empty state centered in modal */
.sg-modal-photos-empty { display: flex; align-items: center; justify-content: center; min-height: 120px; }
.sg-empty-center {
  text-align: center;
  background: transparent;
  padding: 18px;
  font-size: 15px;
  color: var(--muted);
  font-style: italic;
}

/* Upload zone replaces the empty state */
.sg-upload-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  width: 100%;
  border: 2px dashed var(--rule-strong);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: .04em;
  text-transform: uppercase;
  transition: border-color .15s, background .15s, color .15s;
}
.sg-upload-zone:hover:not(:disabled) {
  border-color: var(--primary);
  background: #eff5fc;
  color: var(--primary);
}
.sg-upload-zone:disabled { cursor: default; opacity: 0.6; }

.modal-actions-single { justify-content: flex-end; }

/* ============================================================
   Servicii inline section in Funcțional — stacked galleries
   ============================================================ */
.svc-inline-wrap { margin-top: 56px; padding-top: 36px; border-top: 1px solid var(--rule-strong); }
.svc-inline-head h2 { font-family: var(--ff-display, serif); font-size: 32px; font-weight: 500; margin: 0 0 8px; letter-spacing: -.01em; color: var(--ink); }
.svc-inline-head p { color: var(--muted); font-size: 13.5px; max-width: 720px; margin: 0 0 28px; line-height: 1.5; }
.svc-inline-list { display: flex; flex-direction: column; gap: 36px; }
.svc-block {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 22px 22px 24px;
}
.svc-block-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.svc-block-title {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
}
.svc-block-hint {
  font-family: var(--ff-mono, ui-monospace, monospace);
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: .02em;
}
.svc-photos {
  display: grid;
  gap: 10px;
}
.svc-photos-c1 { grid-template-columns: 1fr; }
.svc-photos-c2 { grid-template-columns: repeat(2, 1fr); }
.svc-photos-c3 { grid-template-columns: repeat(3, 1fr); }
.svc-photos-c4 { grid-template-columns: repeat(4, 1fr); }
.svc-photo {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  overflow: hidden;
  background: #f0f2f5;
}
.svc-photos-c1 .svc-photo { aspect-ratio: 16 / 9; }
.svc-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 880px) {
  .svc-photos-c3, .svc-photos-c4 { grid-template-columns: repeat(2, 1fr); }
}

/* Stacked layout for the SERVICII category (one row per service: title big above + photo big below) */
.si-stack { display: flex; flex-direction: column; gap: 24px; }
.si-stack-row {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
}
.si-stack-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--rule);
}
.si-stack-title {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  color: var(--ink);
}
.si-stack-photo {
  width: 100%;
  aspect-ratio: 16 / 7;
  background: #f0f2f5;
  overflow: hidden;
}
.si-stack-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 880px) {
  .si-stack-photo { aspect-ratio: 16 / 9; }
}

/* Label as link to the public site location */
.si-label-link {
  display: block;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: color .15s;
}
.si-label-link:hover {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-color: var(--gold, #c69531);
  text-underline-offset: 3px;
}

/* Visibility toggle on gallery cards */
.si-vis-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-family: var(--ff-mono, ui-monospace, monospace);
  letter-spacing: .04em;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: 8px;
  user-select: none;
}
.si-vis-toggle input { margin: 0; }
.si-vis-toggle:has(input:checked) { color: var(--success, #16a34a); }
.si-vis-toggle:has(input:not(:checked)) { color: var(--signal, #9c2a35); }

/* Site image preview when picked in modal (replace mode) */
.sg-current-preview {
  display: flex;
  gap: 14px;
  padding: 14px;
  background: #f8fafc;
  border-radius: 6px;
  align-items: center;
}
.sg-current-preview img {
  width: 110px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}
.sg-current-info { flex: 1; min-width: 0; }
.sg-current-label { font-weight: 600; font-size: 14px; color: var(--ink); margin-bottom: 4px; }
.sg-current-path { font-family: var(--ff-mono, ui-monospace, monospace); font-size: 11.5px; color: var(--muted); word-break: break-all; }

/* Visibility switch — pill-style toggle visible on every photo card */
.si-vis-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 10px 4px 6px;
  border-radius: 999px;
  font-size: 11.5px;
  font-family: var(--ff-mono, ui-monospace, monospace);
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  transition: background .15s, color .15s;
  user-select: none;
  margin-bottom: 8px;
}
.si-vis-switch input { display: none; }
.si-vis-knob {
  width: 30px;
  height: 16px;
  background: var(--rule-strong);
  border-radius: 999px;
  position: relative;
  transition: background .2s;
  flex-shrink: 0;
}
.si-vis-knob::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}
.si-vis-switch.on { background: rgba(46, 125, 79, .1); color: var(--success); }
.si-vis-switch.on .si-vis-knob { background: var(--success); }
.si-vis-switch.on .si-vis-knob::after { transform: translateX(14px); }
.si-vis-switch.off { background: rgba(156, 42, 53, .08); color: var(--danger); }
.si-vis-switch.off .si-vis-knob { background: rgba(156, 42, 53, .35); }
.si-vis-switch:hover { filter: brightness(0.97); }

/* Dim invisible cards so it's obvious */
.si-card:has(.si-vis-switch.off) .si-thumb img { opacity: 0.45; filter: grayscale(0.6); }

/* === Reply / email modals === */
.modal-info {
  margin: 10px 0 0;
  padding: 10px 14px;
  background: rgba(46, 125, 79, 0.08);
  color: var(--success);
  border-left: 3px solid var(--success);
  border-radius: 0 3px 3px 0;
  font-size: 13px;
}
.reply-btn {
  background: rgba(31, 77, 140, 0.08) !important;
  color: var(--primary) !important;
  font-weight: 600 !important;
}
.reply-btn:hover {
  background: var(--primary) !important;
  color: #fff !important;
}
.reply-modal { display: flex; flex-direction: column; gap: 14px; }
.reply-summary { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; background: var(--bg); border-radius: 4px; }
.reply-label { font-family: var(--ff-mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.reply-val { font-size: 14px; color: var(--ink); }
.reply-field { display: flex; flex-direction: column; gap: 6px; }
.reply-field span { font-family: var(--ff-mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.reply-field select { padding: 10px 12px; border: 1px solid var(--rule-strong); border-radius: 4px; background: #fff; font-size: 14px; }

.reply-preview { display: flex; flex-direction: column; gap: 6px; }
.reply-preview-label { font-family: var(--ff-mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.reply-preview-frame {
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 6px 16px rgba(14, 49, 96, 0.04);
}
.reply-preview-tricolor {
  height: 3px;
  background: linear-gradient(90deg, #0050a8 0% 33.33%, #ffd400 33.33% 66.66%, #cc092f 66.66% 100%);
}
.reply-sent {
  text-align: center;
  padding: 32px 16px 12px;
}
.reply-sent-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--success);
  color: #fff;
  font-size: 36px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 18px;
}

/* === My emails modal === */
.emails-modal { display: flex; flex-direction: column; gap: 10px; }
.emails-list { display: flex; flex-direction: column; gap: 8px; }
.email-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 4px;
  border: 1px solid var(--rule);
}
.email-addr { font-size: 14px; color: var(--ink); font-weight: 500; word-break: break-all; }
.email-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.email-actions { display: flex; gap: 6px; flex-shrink: 0; }
.email-verify-box {
  margin-top: 10px;
  padding: 14px;
  background: rgba(31, 77, 140, 0.05);
  border-radius: 4px;
  border: 1px dashed var(--primary);
}
.email-add-form { display: flex; flex-direction: column; gap: 10px; }
.email-add-form label { display: flex; flex-direction: column; gap: 6px; }
.email-add-form span { font-family: var(--ff-mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.email-add-form input { padding: 10px 12px; border: 1px solid var(--rule-strong); border-radius: 4px; font-size: 14px; }

/* Sent reply button: green check state */
.reply-btn.sent {
  background: rgba(46, 125, 79, 0.12) !important;
  color: var(--success) !important;
  font-weight: 600 !important;
}
.reply-btn.sent:hover {
  background: var(--success) !important;
  color: #fff !important;
}

/* Disabled reply button (when not yet marked as read) */
.reply-btn.disabled,
.reply-btn[disabled] {
  background: rgba(0,0,0,0.04) !important;
  color: var(--muted) !important;
  font-weight: 600 !important;
  cursor: not-allowed !important;
  opacity: 0.7;
}
.reply-btn.disabled:hover,
.reply-btn[disabled]:hover {
  background: rgba(0,0,0,0.04) !important;
  color: var(--muted) !important;
}

/* ============================================================
   MOBILE LAYOUT (≤ 760px)
   - Top bar with hamburger
   - Slide-in drawer sidebar
   - Card-based row lists (tables collapse)
   - Larger touch targets, full-screen modals
   ============================================================ */
.mobile-topbar { display: none; }
.mobile-scrim { display: none; }

@media (max-width: 760px) {
  /* App shell becomes single column, no sticky sidebar */
  .app-shell {
    display: block;
    min-height: 100vh;
  }
  /* Top bar */
  .mobile-topbar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--primary-deep);
    color: #fff;
    padding: 0 14px;
    height: 56px;
    box-shadow: 0 2px 10px rgba(10, 37, 72, 0.18);
  }
  .mobile-hamburger {
    background: transparent;
    border: 0;
    width: 40px;
    height: 40px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
  }
  .mobile-hamburger span {
    display: block;
    height: 2px;
    background: #fff;
    border-radius: 1px;
  }
  .mobile-title {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    flex: 1;
    text-align: center;
    letter-spacing: .02em;
  }
  .mobile-brand {
    font-family: var(--ff-mono);
    font-size: 10px;
    letter-spacing: .18em;
    color: rgba(255, 255, 255, 0.55);
    font-weight: 600;
    text-transform: uppercase;
  }

  /* Sidebar: hidden by default, slides in from left */
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0;
    bottom: 0;
    width: 280px !important;
    max-width: 84vw;
    height: 100vh !important;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.2, 0.7, 0.2, 1);
    box-shadow: 4px 0 32px rgba(10, 37, 72, 0.3);
    overflow: hidden;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
  }
  .app-shell.drawer-open .sidebar { transform: translateX(0); }
  /* Re-enable brand + foot (older mobile CSS hid them) */
  .sidebar-brand, .sidebar-foot { display: flex !important; }
  .sidebar-foot { flex-direction: column; align-items: flex-start; }
  .sidebar-nav {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    padding: 14px 0 !important;
    flex: 1;
    overflow-y: auto;
  }
  .sidebar-nav button {
    border-left: 3px solid transparent !important;
    padding: 14px 22px !important;
    white-space: normal;
    text-align: left;
    border-bottom: 0 !important;
  }
  .sidebar-nav button.on {
    border-left-color: var(--gold) !important;
    border-bottom: 0 !important;
    padding-left: 19px !important;
  }
  .mobile-scrim {
    display: block !important;
    position: fixed;
    inset: 0;
    background: rgba(10, 37, 72, 0.5);
    z-index: 45;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }
  .sidebar-brand {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px !important;
  }
  .mobile-close {
    display: flex !important;
    background: transparent;
    border: 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 28px;
    line-height: 1;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
  }
  .mobile-close:hover { color: #fff; }
  .sidebar-brand b { font-size: 18px; }

  /* Bigger touch targets in drawer */
  .sidebar-nav button {
    padding: 14px 22px !important;
    font-size: 15px !important;
  }

  /* Main content area */
  .main {
    padding: 16px 14px 32px !important;
    overflow-x: hidden !important;
  }
  .page-head {
    flex-direction: column !important;
    align-items: stretch !important;
    margin-bottom: 18px;
    gap: 10px;
  }
  .page-head h1 { font-size: 22px; }
  .page-head p { font-size: 13px; }
  .page-head .btn {
    align-self: flex-start;
    padding: 10px 14px;
    font-size: 13px;
  }

  /* Tables become a stack of cards */
  table.data { display: block; border: 0; }
  table.data thead { display: none; }
  table.data tbody { display: block; }
  table.data tr {
    display: block;
    background: #fff;
    border: 1px solid var(--rule);
    border-radius: 8px;
    margin-bottom: 12px;
    padding: 14px 16px;
    box-shadow: 0 1px 3px rgba(14, 49, 96, 0.04);
  }
  table.data tr:hover { background: #fff; }
  table.data td {
    display: block;
    padding: 6px 0;
    border-bottom: 0;
    text-align: left !important;
  }
  table.data td .row-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
  table.data td .row-meta { font-size: 13px; }
  table.data .row-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--rule);
    margin-top: 8px;
  }
  table.data .row-actions button,
  table.data .row-actions a {
    min-height: 36px;
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 4px;
  }
  /* Tag pill stays inline */
  table.data .tag { display: inline-block; margin-top: 4px; }

  /* Modals: full screen on small phones */
  .modal-bg { padding: 0; align-items: flex-end; }
  .modal {
    width: 100%;
    max-width: 100%;
    min-height: 60vh;
    max-height: 95vh;
    border-radius: 16px 16px 0 0;
    padding: 22px 18px 24px;
  }
  .modal h2 { font-size: 18px; margin-bottom: 14px; }
  .modal-form .row-2, .modal-form .row-3 { grid-template-columns: 1fr !important; gap: 12px; }
  .modal input, .modal select, .modal textarea {
    font-size: 16px;
    padding: 11px 12px;
  }
  .modal-actions {
    flex-direction: column-reverse;
    gap: 8px;
    padding-top: 14px;
  }
  .modal-actions button {
    width: 100%;
    justify-content: center;
    padding: 12px 14px;
    font-size: 14px;
    min-height: 44px;
  }

  /* Funcțional: cards stack 1-per-row, no horizontal scroll */
  .si-grid { grid-template-columns: 1fr !important; gap: 14px; }
  .si-card { box-shadow: 0 1px 3px rgba(14, 49, 96, 0.04); }
  .si-thumb { aspect-ratio: 16 / 9; }
  .si-actions { flex-wrap: wrap; gap: 6px; padding: 8px 14px 14px; }

  /* Hide path under image label on mobile (looks cluttered) */
  .si-path { display: none; }

  /* Tighten group headers */
  .si-group h2 { font-size: 14px; }

  /* Login screen tweaks */
  .login-card { padding: 28px 22px; max-width: 100%; }
  .login-form input { font-size: 16px; padding: 12px 14px; }
}

/* Smaller phones */
@media (max-width: 380px) {
  .mobile-topbar { padding: 0 10px; }
  .mobile-title { font-size: 14px; }
  .main { padding: 12px 10px 28px !important; }
  .modal { padding: 18px 14px 20px; }
}

/* By default hide mobile-only chrome on desktop */
.mobile-close { display: none; }
