:root {
  --bg: #f7f3e9;
  --ink: #1c1a17;
  --card: #fffdf9;
  --line: #d7c8af;
  --accent: #9b2226;
  --accent-2: #ca6702;
  --muted: #6f6658;
  /* Landing */
  --l-bg-from: #0f1320;
  --l-bg-to:   #1e2640;
  --l-card:    #ffffff;
  --l-border:  rgba(255,255,255,0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top right, #fff4d6 0, transparent 45%), var(--bg);
}

/* ─── LANDING SCREEN ────────────────────────────────────── */
.landing-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 16px;
  background: linear-gradient(145deg, var(--l-bg-from) 0%, var(--l-bg-to) 100%);
  overflow-y: auto;
}
.landing-screen.hidden { display: none !important; }

.landing-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(155,34,38,0.22) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 110%, rgba(202,103,2,0.15) 0%, transparent 60%),
    radial-gradient(#ffffff09 1px, transparent 1px);
  background-size: auto, auto, 22px 22px;
}

.landing-card {
  position: relative;
  z-index: 1;
  background: var(--l-card);
  border-radius: 24px;
  box-shadow:
    0 30px 80px rgba(0,0,0,0.45),
    0 0 0 1px rgba(255,255,255,0.06);
  padding: 44px 44px 36px;
  width: 100%;
  max-width: 480px;
}

.landing-brand {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 28px;
}

.landing-logo {
  width: 68px;
  height: 68px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 6px 18px rgba(155,34,38,0.35));
}

.landing-brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.landing-brand-name {
  font-family: "Sora", "Manrope", sans-serif;
  font-weight: 800;
  font-size: 1.35rem;
  color: #111;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.landing-brand-tagline {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.landing-divider {
  height: 1px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);
  margin-bottom: 24px;
  border-radius: 1px;
}

.landing-title {
  font-family: "Sora", "Manrope", sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #111;
  margin: 0 0 8px;
  line-height: 1.25;
}

.landing-desc {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 24px;
}

.landing-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

.landing-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.landing-field label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #444;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.landing-field input {
  font: inherit;
  border: 1.5px solid #ddd;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.95rem;
  background: #fafafa;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}

.landing-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(155,34,38,0.1);
  background: #fff;
}

.landing-field input:disabled {
  background: #f0f0f0;
  color: #999;
  cursor: not-allowed;
}

.landing-pwd-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.landing-login-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
}

.landing-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  color: #4b5563;
}

.landing-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.landing-pwd-wrap input {
  flex: 1;
  padding-right: 48px;
}

.pwd-toggle {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  padding: 4px 6px;
  cursor: pointer;
  font-size: 1rem;
  color: var(--muted);
  line-height: 1;
  border-radius: 6px;
}

.pwd-toggle:hover { background: #f0f0f0; }

.landing-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, #c0292e 50%, var(--accent-2) 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 700;
  font-family: "Sora", "Manrope", sans-serif;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: opacity 0.15s, transform 0.12s;
  box-shadow: 0 4px 18px rgba(155,34,38,0.35);
  margin-top: 4px;
}

.landing-btn:hover:not(:disabled) { opacity: 0.92; transform: translateY(-1px); }
.landing-btn:active:not(:disabled) { transform: translateY(0); }

.landing-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.landing-btn-icon {
  font-size: 1.1rem;
  font-style: normal;
}

.landing-features {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.landing-feat {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f4f4f4;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #555;
}

.landing-footer {
  position: relative;
  z-index: 1;
  margin-top: 28px;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.38);
  text-align: center;
  letter-spacing: 0.02em;
}

/* Error dentro del landing */
.landing-screen .error {
  min-height: 20px;
  font-size: 0.85rem;
  color: #b11226;
  margin: 0;
}

.landing-screen .lockout-msg {
  background: #fff0f0;
  border: 1px solid #f5c6cb;
  border-radius: 8px;
  padding: 10px 14px;
  color: #7a0010;
  font-weight: 600;
  font-size: 0.85rem;
}

/* Responsive landing */
@media (max-width: 520px) {
  .landing-card { padding: 30px 22px 26px; border-radius: 18px; }
  .landing-title { font-size: 1.25rem; }
  .landing-brand-name { font-size: 1.15rem; }
}

/* ─── END LANDING ────────────────────────────────────────── */

.bg-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image: radial-gradient(#9b222622 1px, transparent 1px);
  background-size: 18px 18px;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 1220px;
  margin: 24px auto;
  padding: 0 16px;
}

.platform-credit {
  max-width: 1220px;
  margin: 0 auto 14px;
  text-align: center;
  font-size: 1rem;
  letter-spacing: 0.01em;
  color: rgba(46, 36, 24, 0.72);
  font-weight: 500;
  font-style: italic;
  font-family: "Brush Script MT", "Segoe Script", cursive;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 16px 35px rgba(60, 40, 15, 0.1);
  padding: 20px;
}

.admin-brand-row {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.admin-brand-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(20, 15, 8, 0.22));
}

.admin-brand-text {
  font-family: "Sora", "Manrope", sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}

h1, h2, h3 { margin: 0 0 10px; font-family: "Sora", "Manrope", sans-serif; }

.muted { color: var(--muted); }
.error { color: #b11226; min-height: 24px; font-size: 0.9rem; }
.lockout-msg {
  background: #fff0f0;
  border: 1px solid #f5c6cb;
  border-radius: 8px;
  padding: 10px 14px;
  color: #7a0010;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
}
.hidden { display: none !important; }

.form-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

label { display: grid; gap: 6px; font-weight: 600; }

input, button, select, textarea {
  font: inherit;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  background: white;
}

button {
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border: none;
  font-weight: 700;
}

button.ghost {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #e9d8be;
  border-radius: 14px;
  background: linear-gradient(135deg, #fffaf2, #fff3df);
}

.topbar-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  vertical-align: middle;
  margin-right: 10px;
  filter: drop-shadow(0 4px 8px rgba(20, 15, 8, 0.2));
}

.tabs {
  display: flex;
  gap: 6px;
  margin: 16px 0;
  padding: 6px;
  border: 1px solid #ead8bd;
  border-radius: 12px;
  background: #fff8ed;
  width: fit-content;
}

.tabs button {
  background: transparent;
  color: #663a00;
  border-radius: 9px;
}

.tabs button.active {
  background: linear-gradient(135deg, #9b2226, #ca6702);
  color: #fff;
}

.tab-badge {
  display: inline-block;
  background: #ef4444;
  color: #fff;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  padding: 0 5px;
  margin-left: 5px;
  line-height: 16px;
  vertical-align: middle;
}
.tab-badge.hidden { display: none; }

.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.toolbar input { flex: 1; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
  background: #fff;
}

th, td {
  border-bottom: 1px solid #efe1ca;
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

th { background: #fff8ef; position: sticky; top: 0; }

.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
}

.pill.ok { background: #e4f8ea; color: #146c2d; }
.pill.bad { background: #ffe3e5; color: #a8192d; }
.pill.admin { background: #ede8ff; color: #4b2fa5; }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions button { font-size: 12px; padding: 6px 8px; }

/* Client name — span, sin estilos de botón */
.client-name-btn,
#adminView .client-name-btn {
  display: inline;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  min-height: unset !important;
  font: inherit;
  color: #0f172a !important;
  cursor: pointer;
  text-align: left;
  border-radius: 0 !important;
}
.client-name-btn:hover strong { text-decoration: none; color: #0f172a; }
.client-name-btn strong { font-size: 14px; }

.btn-danger { color: #c0392b; border-color: #c0392b; }
.btn-danger:hover { background: #fdecea; }

/* Notificación flotante (no-interactiva) */
.snack-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #f8fafc;
  padding: 11px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.22);
  z-index: 9999;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.3s ease;
}
.snack-toast.hidden { opacity: 0; }

/* Panel papelera de reciclaje */
.trash-panel-toggle {
  display: none;
}
/* Icono papelera en header del cliente */
.trash-icon-btn {
  position: relative;
  background: none !important;
  border: 1.5px solid #fca5a5 !important;
  border-radius: 8px !important;
  color: #b91c1c !important;
  font-size: 16px !important;
  padding: 5px 9px !important;
  cursor: pointer;
  box-shadow: none !important;
  min-height: unset !important;
  line-height: 1;
  transition: background 0.15s;
}
.trash-icon-btn:hover { background: #fff5f5 !important; }
.trash-icon-btn.active { background: #fee2e2 !important; border-color: #ef4444 !important; }
.trash-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 99px;
  padding: 1px 5px;
  line-height: 1.4;
  pointer-events: none;
}

.clients-trash-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.clients-bulk-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid #d8e4f5;
  border-radius: 10px;
  background: #f6faff;
}

.clients-select-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #334155;
  font-weight: 600;
}

.clients-select-col {
  width: 40px;
}

.clients-select-cell {
  text-align: center;
  vertical-align: middle;
}

.client-select-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.trash-panel {
  margin-top: 16px;
  background: #fff8f8;
  border: 1px solid #fecaca;
  border-radius: 12px;
  overflow: hidden;
}
.trash-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #fff1f1;
  border-bottom: 1px solid #fecaca;
  font-size: 13px;
  font-weight: 700;
  color: #991b1b;
}
.trash-case-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid #fee2e2;
  flex-wrap: wrap;
}
.trash-case-row:last-child { border-bottom: none; }
.trash-case-row .trash-case-label {
  flex: 1;
  min-width: 120px;
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
}
.trash-case-row .trash-case-meta {
  font-size: 12px;
  color: #64748b;
  flex: 2;
  min-width: 100px;
}

/* Client info card (header de vista de casos) */
.case-head {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.client-info-card {
  background: #f8faff;
  border: 1px solid #dce8fb;
  border-radius: 14px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 260px;
}
.client-info-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.client-info-name {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
}
.client-info-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #64748b;
}
.client-info-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.client-action-btn {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #1e293b;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}
.client-action-btn:hover { background: #f1f5f9; }
.client-action-btn.btn-warning { border-color: #f59e0b; color: #92400e; background: #fffbeb; }
.client-action-btn.btn-warning:hover { background: #fef3c7; }
.client-action-btn.btn-ok { border-color: #22c55e; color: #166534; background: #f0fdf4; }
.client-action-btn.btn-ok:hover { background: #dcfce7; }
.client-action-btn.btn-destructive { border-color: #fca5a5; color: #b91c1c; background: #fff5f5; }
.client-action-btn.btn-destructive:hover { background: #fee2e2; }
.btn-back {
  white-space: nowrap;
  align-self: flex-start;
  margin-top: 4px;
}

.case-head-side {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
}

.client-actions-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding: 10px 12px;
  background: #f0f5ff;
  border-radius: 10px;
  border: 1px solid #c7d7fa;
  animation: fadeIn 0.15s ease;
}
.client-actions-panel.hidden { display: none; }
.client-actions-panel button { font-size: 12px; padding: 6px 10px; }

.block { display: block; }

.row-link-btn {
  background: transparent;
  color: #0f172a;
  border: 0;
  border-radius: 0;
  padding: 0;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  box-shadow: none;
}

.row-link-btn:hover {
  color: #1d4ed8;
  transform: none;
  filter: none;
}

.cases-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}

.cases-workspace {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.cases-client-list {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #fffdfa, #fff6ea);
  padding: 12px;
  position: sticky;
  top: 12px;
  box-shadow: 0 8px 20px rgba(92, 57, 8, 0.08);
}

.cases-client-list h3 {
  margin-bottom: 6px;
}

.client-list-scroll {
  max-height: 72vh;
  overflow: auto;
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.client-item {
  width: 100%;
  text-align: left;
  padding: 10px;
  border: 1px solid #e7d7bc;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  display: grid;
  gap: 4px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.client-item:hover {
  transform: translateY(-1px);
  border-color: #d79641;
  box-shadow: 0 8px 18px rgba(126, 80, 18, 0.12);
}

.client-item.active {
  border-color: #c6691f;
  box-shadow: 0 0 0 2px #ffe5cb, 0 10px 20px rgba(126, 80, 18, 0.14);
  background: #fffaf2;
}

.client-item span,
.client-item small {
  color: var(--muted);
}

.case-detail-view {
  min-width: 0;
}

.owner-dashboard {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.owner-insights {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(280px, 1fr);
  gap: 10px;
  border: 1px solid #e7d7bc;
  border-radius: 12px;
  background: linear-gradient(140deg, #fff9ef, #fff3e2);
  padding: 12px;
}

.owner-insight-main h4 {
  margin: 0 0 6px;
  font-size: 16px;
}

.owner-insight-main p {
  margin: 0 0 6px;
  font-size: 13px;
}

.owner-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 8px;
}

.owner-stat {
  display: grid;
  border: 1px solid #eadbc6;
  border-radius: 10px;
  background: #fffdf9;
  padding: 8px 10px;
}

.owner-stat strong {
  font-size: 18px;
  color: #6d3b06;
}

.owner-stat span {
  font-size: 12px;
  color: var(--muted);
}

.case-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.case-summary-card {
  border: 1px solid #e7d7bc;
  border-radius: 11px;
  background: linear-gradient(180deg, #ffffff, #fffaf2);
  color: #5a3a13;
  display: grid;
  gap: 0;
  position: relative;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.case-summary-card:hover {
  border-color: #d98f34;
  box-shadow: 0 10px 20px rgba(128, 77, 8, 0.12);
}

.case-summary-card.active {
  border-color: #c6691f;
  box-shadow: 0 0 0 2px #ffe5cb, 0 10px 20px rgba(126, 80, 18, 0.14);
  background: #fffcf6;
}

.case-summary-body {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: inherit !important;
  text-align: left;
  padding: 10px;
  display: grid;
  gap: 6px;
  cursor: pointer;
  border-radius: 10px 10px 0 0;
  width: 100%;
}

.case-delete-btn {
  display: block;
  width: 100%;
  border: none !important;
  border-top: 1px solid #f0e4d0 !important;
  border-radius: 0 0 10px 10px !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #9e3a2f !important;
  font-size: 12px;
  padding: 5px 10px !important;
  cursor: pointer;
  text-align: left;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
  min-height: unset !important;
}

.case-summary-card:hover .case-delete-btn {
  opacity: 1;
}

.case-delete-btn:hover {
  background: #fff0ee !important;
}

.case-summary-card p {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #3f2b12;
}

.case-summary-card small {
  color: var(--muted);
  font-size: 12px;
}

.case-summary-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.case-summary-top span {
  font-size: 12px;
  color: #8a4e0f;
  font-weight: 700;
}

.case-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.case-selector-item {
  border: 1px solid #e7d7bc;
  background: #fff;
  color: #5a3a13;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 700;
}

.case-selector-item.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-color: transparent;
}

.case-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: linear-gradient(180deg, #fff, #fffcf7);
  box-shadow: 0 10px 24px rgba(95, 58, 8, 0.08);
}

.case-card h3 { font-size: 16px; }
.meta { color: var(--muted); font-size: 13px; margin-bottom: 8px; }

.case-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.case-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.case-pdf-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: #5d3914;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
}

.case-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff3e0;
  color: #7a4a12;
  font-size: 12px;
  font-weight: 700;
}

.case-badge.accent {
  background: #fce7e8;
  color: #9b2226;
}

.case-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.6fr);
  gap: 14px;
}

.case-summary,
.case-photos-panel {
  display: grid;
  gap: 12px;
}

.detail-block {
  border: 1px solid #efe1ca;
  border-radius: 12px;
  padding: 12px;
  background: #fffdfa;
}

.detail-block h4 {
  margin: 0 0 10px;
  font-family: "Sora", "Manrope", sans-serif;
  font-size: 14px;
}

.detail-block p {
  margin: 0 0 8px;
  line-height: 1.5;
}

.room-section {
  border-top: 1px solid #efe1ca;
  padding-top: 12px;
  margin-top: 12px;
}

.room-section:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.room-section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.room-section-head h4 {
  margin-bottom: 4px;
}

.room-metrics {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.room-damage {
  margin: 5px 0 0;
  font-size: 13px;
  color: #5e4d38;
}

.room-photo-count {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  background: #fdf1de;
  color: #91520b;
  font-size: 12px;
  font-weight: 700;
}

.room-chip {
  display: inline-flex;
  margin: 3px 5px 3px 0;
  padding: 4px 7px;
  border-radius: 999px;
  background: #fff0dd;
  font-size: 12px;
}
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 8px;
}

.ordered-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.photo-summary {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.photo-card {
  margin: 0;
  border: 1px solid #eadbc2;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  content-visibility: auto;
  contain-intrinsic-size: 250px 260px;
}

.attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.attachment-card {
  border: 1px solid #eadbc2;
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}

.attachment-title {
  font-weight: 700;
  font-size: 13px;
  color: #3f2b12;
  margin-bottom: 4px;
}

.attachment-meta {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.photo-empty {
  grid-column: 1 / -1;
  padding: 12px;
  border: 1px dashed #d7c8af;
  border-radius: 8px;
  background: #fff8ef;
  text-align: center;
}

.photo-grid img,
.photo-thumb {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
  border: none;
  outline: none;
}

.photo-caption {
  padding: 10px 10px 6px;
  font-size: 12px;
  min-height: 46px;
  color: #473a2a;
}

.photo-actions {
  display: flex;
  gap: 8px;
  padding: 0 10px 10px;
}

.photo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  flex: 1;
  padding: 8px 10px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}

.ghost-link {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.room-materials {
  margin: 4px 0 0;
  font-size: 13px;
  color: #4a3a28;
}

.case-action-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 6px;
}

.case-edit-btn {
  border: 1px solid #b07d1a;
  background: #fffaed;
  color: #6b4a00;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
}

.case-edit-btn:hover { background: #fff3c0; }

.case-delete-btn {
  border: none;
  background: #fce7e8;
  color: #9b2226;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
}

.case-delete-btn:hover {
  background: #9b2226;
  color: #fff;
}

.case-pdf-btn:hover,
.case-edit-btn:hover,
.case-delete-btn:hover {
  transform: translateY(-1px);
}

.edit-case-panel {
  border: 2px solid #c6961f;
  border-radius: 14px;
  padding: 18px;
  background: #fffdf5;
  margin-bottom: 14px;
}

.edit-case-panel h4 {
  margin: 0 0 14px;
  font-size: 15px;
}

.edit-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.edit-label {
  display: grid;
  gap: 5px;
  font-weight: 600;
  font-size: 13px;
}

.edit-label-full { grid-column: 1 / -1; }

.edit-label input,
.edit-label textarea {
  font: inherit;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 8px 10px;
  background: white;
  width: 100%;
}

.edit-label textarea { resize: vertical; }

.edit-form-actions {
  display: flex;
  gap: 10px;
}

.edit-form-actions button { padding: 9px 16px; font-size: 13px; }

.detail-text-block {
  white-space: pre-line;
  line-height: 1.55;
  margin: 0;
  font-size: 13px;
}

.room-chip-full {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid #efe1ca;
  border-radius: 10px;
  background: #fff8f0;
  font-size: 13px;
}

.room-chip-full strong {
  font-size: 14px;
  margin-bottom: 2px;
}

.room-chip-full span { color: #5e4a30; }

@media (max-width: 760px) {
  .toolbar { flex-direction: column; }
  .cases-workspace { grid-template-columns: 1fr; }
  .cases-client-list { position: static; }
  .owner-insights { grid-template-columns: 1fr; }
  .owner-stat-grid { grid-template-columns: 1fr 1fr; }
  .case-head,
  .room-section-head,
  .case-layout { grid-template-columns: 1fr; display: grid; }
  .case-actions { justify-items: start; }
  .case-badges { justify-content: flex-start; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
  .ordered-grid { grid-template-columns: repeat(1, 1fr); }
}

/* Visual refresh v3 */
:root {
  --bg: #f3efe7;
  --ink: #1f262c;
  --card: #fffdfa;
  --line: #dcc8ad;
  --accent: #0c6c72;
  --accent-2: #bf5f24;
  --muted: #5f6a73;
  --ok-bg: #e7f8ef;
  --ok-ink: #11633a;
  --bad-bg: #fde9eb;
  --bad-ink: #9b1f32;
}

body {
  font-family: "Manrope", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 8% 12%, #e8f8fb 0, transparent 33%),
    radial-gradient(circle at 90% 18%, #ffe9d9 0, transparent 36%),
    linear-gradient(180deg, #f9f4ea, #f2ede3);
}

.bg-noise {
  opacity: 0.16;
}

.panel {
  border-radius: 22px;
  border: 1px solid #ddceb5;
  box-shadow: 0 26px 46px rgba(65, 48, 22, 0.12);
}

h1, h2, h3 {
  font-family: "Fraunces", "Sora", serif;
  letter-spacing: 0.01em;
}

button,
.photo-link,
.case-summary-card,
.client-item,
.case-pdf-btn,
.case-edit-btn,
.case-delete-btn,
.case-selector-item {
  transition: transform 0.16s ease, box-shadow 0.18s ease, filter 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

button:hover,
.case-summary-card:hover,
.client-item:hover,
.case-pdf-btn:hover,
.case-edit-btn:hover,
.case-delete-btn:hover,
.photo-link:hover {
  transform: translateY(-1px);
  filter: saturate(1.05);
}

button {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 16px rgba(12, 108, 114, 0.22);
}

button.ghost {
  border: 1px solid #cebfa8;
  box-shadow: none;
}

.topbar {
  border-color: #d8c7ad;
  background: linear-gradient(120deg, #fff8ed 0%, #fff3e6 46%, #eef9fb 100%);
  box-shadow: 0 12px 26px rgba(80, 57, 20, 0.1);
}

.topbar-head {
  display: grid;
  gap: 4px;
}

.topbar-kicker {
  display: inline-flex;
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #0d5961;
  background: #dcf4f6;
  border: 1px solid #bce5e8;
}

.topbar h2 {
  margin: 0;
  font-size: clamp(22px, 2.2vw, 30px);
}

.tabs {
  gap: 8px;
  border-color: #d9c8ad;
  border-radius: 14px;
  background: linear-gradient(180deg, #fff8ee, #fff4e6);
}

.tabs button {
  min-width: 130px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.tabs button.active {
  box-shadow: 0 10px 18px rgba(17, 100, 96, 0.24);
}

.toolbar {
  margin: 14px 0 12px;
}

.toolbar input {
  border-radius: 12px;
  border: 1px solid #d3c0a5;
  background: #fffefb;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.stat-chip {
  border: 1px solid #dfceb6;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #fff8ee);
  padding: 10px 12px;
  display: grid;
  gap: 2px;
}

.stat-chip small {
  color: #6a635a;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-chip strong {
  color: #1f2f35;
  font-size: 18px;
  line-height: 1.2;
}

.table-wrap {
  border-radius: 14px;
  border: 1px solid #dac8ad;
  box-shadow: 0 10px 24px rgba(86, 62, 23, 0.08);
}

th {
  background: linear-gradient(180deg, #fff6ea, #ffefd9);
  color: #4f3719;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tbody tr:nth-child(even) {
  background: #fffdf9;
}

tbody tr:hover {
  background: #fef7eb;
}

.pill.ok {
  background: var(--ok-bg);
  color: var(--ok-ink);
}

.pill.bad {
  background: var(--bad-bg);
  color: var(--bad-ink);
}

.pill.admin {
  background: #def2ff;
  color: #1f5472;
}

.cases-client-list {
  border-color: #d6c3a4;
  border-radius: 14px;
  background:
    linear-gradient(180deg, #fffdfa, #fff4e4),
    radial-gradient(circle at top right, #eaf8fb, transparent 46%);
}

.client-item {
  border-radius: 12px;
  border: 1px solid #d8c5ab;
}

.client-item.active {
  border-color: #0b757a;
  box-shadow: 0 0 0 2px #d4f0f2, 0 14px 20px rgba(9, 96, 101, 0.14);
  background: #f3fbfc;
}

.owner-insights {
  border-color: #d7c4a8;
  background: linear-gradient(125deg, #fff9ef, #f3fbfc);
}

.owner-stat {
  border-color: #ddcbb1;
}

.owner-stat strong {
  color: #1f5a5f;
}

.case-summary-card {
  border-color: #d8c4a7;
}

.case-summary-card.active {
  border-color: #0e7479;
  box-shadow: 0 0 0 2px #d4f0f2, 0 12px 24px rgba(15, 101, 108, 0.18);
  background: linear-gradient(180deg, #ffffff, #f2fcfd);
}

.case-card {
  border-color: #d8c5a9;
  border-radius: 15px;
  box-shadow: 0 16px 30px rgba(70, 53, 22, 0.1);
}

.detail-block {
  border-color: #e1d2bb;
  border-radius: 13px;
  background: linear-gradient(180deg, #ffffff, #fffaf1);
}

.detail-block h4 {
  color: #2a4b55;
}

.photo-card {
  border-color: #e0cfb3;
  border-radius: 11px;
}

.photo-link {
  box-shadow: 0 8px 14px rgba(13, 106, 112, 0.2);
}

.ghost-link {
  box-shadow: none;
}

.case-pdf-btn,
.case-edit-btn,
.case-delete-btn {
  box-shadow: 0 7px 12px rgba(61, 42, 12, 0.09);
}

.case-pdf-btn {
  border-color: #d6c3a6;
}

.case-edit-btn {
  border-color: #0a7075;
  background: #e8f8f9;
  color: #0f5f64;
}

.case-edit-btn:hover {
  background: #d5f0f2;
}

.case-delete-btn {
  border: 1px solid #f3c3cb;
}

.edit-case-panel {
  border-color: #0e7378;
  background: linear-gradient(180deg, #f8fefe, #f3fbfc);
}

@media (max-width: 900px) {
  .case-layout {
    grid-template-columns: 1fr;
  }

  .case-action-btns {
    justify-content: flex-start;
  }

  .stats-strip {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}

@media (max-width: 760px) {
  .panel {
    padding: 14px;
  }

  .topbar {
    padding: 10px;
  }

  .topbar h2 {
    font-size: 23px;
  }

  .tabs {
    width: 100%;
  }

  .tabs button {
    min-width: 0;
    flex: 1;
  }

  .stats-strip {
    grid-template-columns: 1fr;
  }

  .case-action-btns {
    width: 100%;
  }

  .case-action-btns button {
    flex: 1;
  }

  .photo-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Case Detail Page (SPA navigation) ────────────────────────────────────── */

.case-detail-page {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.case-detail-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #111827;
  border-radius: 12px 12px 0 0;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 5;
}

.back-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  color: #e5e7eb;
  border-radius: 8px;
  padding: 7px 13px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
}

.back-btn:hover {
  background: rgba(255,255,255,0.18);
}

.case-detail-label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.case-detail-label strong {
  color: #f3f4f6;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.case-detail-label .muted {
  color: #9ca3af;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.case-detail-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.case-detail-actions button {
  font-size: 12px;
  padding: 6px 11px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
  color: #f3f4f6;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.case-detail-actions button:hover {
  background: rgba(255,255,255,0.2);
}

.case-detail-actions button.ghost {
  background: transparent;
  border-color: rgba(255,255,255,0.1);
  color: #9ca3af;
}

.case-detail-actions button.danger-ghost {
  border-color: #7f1d1d;
  background: rgba(127,29,29,0.25);
  color: #fca5a5;
}

.case-detail-actions button.danger-ghost:hover {
  background: rgba(185,28,28,0.45);
}

.case-detail-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 0;
}

.detail-card {
  background: var(--card, #fffdf9);
  border: 1px solid var(--line, #d7c8af);
  border-radius: 12px;
  padding: 14px 16px;
}

.detail-card h3 {
  margin: 0 0 10px;
  font-size: 17px;
}

.detail-card h4 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
}

.detail-meta-grid {
  display: grid;
  gap: 4px;
}

.detail-meta-grid p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

.text-block {
  white-space: pre-wrap;
  line-height: 1.5;
  font-size: 14px;
}

.tech-body {
  font-size: 14px;
  line-height: 1.5;
}

.tech-body h3 {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  margin: 12px 0 6px;
}

.tech-body p {
  margin: 4px 0;
}

.tech-body .tech-legal {
  color: var(--muted, #6f6658);
  font-style: italic;
}

@media (max-width: 600px) {
  .case-detail-topbar {
    border-radius: 0;
  }
  .case-detail-actions {
    width: 100%;
  }
}

/* ── Unified Professional Navigation Overrides ───────────────────────────── */

:root {
  --bg: #edf2fb;
  --ink: #101828;
  --card: #ffffff;
  --line: #d6e0f0;
  --accent: #175cd3;
  --accent-2: #2970ff;
  --muted: #667085;
}

body {
  background: radial-gradient(circle at top left, #dce8ff 0, transparent 42%), radial-gradient(circle at bottom right, #e8f0ff 0, transparent 40%), var(--bg);
}

.bg-noise {
  opacity: 0.12;
  background-image: radial-gradient(#175cd322 1px, transparent 1px);
}

.tabs {
  display: flex;
}

.panel {
  border-radius: 20px;
  box-shadow: 0 22px 45px rgba(13, 31, 67, 0.12);
}

.topbar {
  border-color: #d6e0f0;
  background: linear-gradient(120deg, #ffffff 0%, #f6f9ff 48%, #eff4ff 100%);
}

.topbar-kicker {
  color: #0b4fd6;
  background: #e9f1ff;
  border: 1px solid #cfe0ff;
}

#casesSection .toolbar {
  position: sticky;
  top: 8px;
  z-index: 3;
  background: linear-gradient(180deg, rgba(237, 242, 251, 0.94), rgba(237, 242, 251, 0.72));
  backdrop-filter: blur(6px);
  border: 1px solid #d6e0f0;
  border-radius: 14px;
  padding: 8px;
}

#casesSection .toolbar input {
  border-radius: 12px;
  border: 1px solid #d0ddf0;
  background: #fff;
}

.cases-list {
  grid-template-columns: 1fr;
}

.fb-shell {
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 14px;
}

.cases-client-list {
  border: 1px solid #d7e2f3;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, #f7faff);
  box-shadow: 0 10px 26px rgba(16, 24, 40, 0.08);
}

.client-item {
  border: 1px solid #dce5f3;
  border-radius: 12px;
  background: #fff;
  position: relative;
  overflow: hidden;
}

.client-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: transparent;
}

.client-item:hover {
  border-color: #adc6f6;
  box-shadow: 0 8px 18px rgba(27, 80, 180, 0.14);
}

.client-item.active {
  border-color: #9dbcf4;
  background: #f5f9ff;
  box-shadow: 0 0 0 2px #e4edff, 0 10px 18px rgba(27, 80, 180, 0.16);
}

.client-item.active::before {
  background: linear-gradient(180deg, #175cd3, #2970ff);
}

.owner-insights {
  border: 1px solid #d9e4f4;
  border-radius: 14px;
  background: linear-gradient(155deg, #ffffff, #f6f9ff);
}

.owner-stat {
  border: 1px solid #d9e4f4;
  border-radius: 11px;
  background: #ffffff;
}

.owner-stat strong {
  color: #1d4ed8;
}

.case-card {
  border: 1px solid #d8e2f1;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, #f9fbff);
  box-shadow: 0 12px 24px rgba(14, 29, 63, 0.08);
}

.case-dashboard-grid {
  grid-template-columns: 1fr;
  gap: 10px;
}

.subgroup-block {
  border: 1px solid #d9e4f4;
  border-radius: 14px;
  background: #ffffff;
  padding: 10px;
  margin-bottom: 10px;
}

.subgroup-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.subgroup-head h4 {
  margin: 0;
  font-size: 14px;
  color: #1d2939;
}

.case-summary-card {
  border: 1px solid #d9e4f4;
  border-radius: 14px;
  background: #ffffff;
  padding: 12px;
}

.case-summary-card:hover {
  border-color: #a7c2f2;
  box-shadow: 0 9px 20px rgba(17, 92, 211, 0.12);
}

.case-summary-card.active {
  border-color: #8cb0ee;
  background: #f4f8ff;
  box-shadow: 0 0 0 2px #e3edff, 0 12px 22px rgba(17, 92, 211, 0.14);
}

.case-summary-card p {
  color: #0f172a;
}

.case-summary-top span {
  color: #1d4ed8;
}

.case-badge {
  background: #e9f2ff;
  color: #1147ad;
}

.case-detail-topbar {
  background: linear-gradient(100deg, #0f172a, #1d2939);
}

@media (max-width: 960px) {
  .fb-shell {
    grid-template-columns: 1fr;
  }

  .cases-client-list {
    position: static;
  }

  .client-list-scroll {
    max-height: none;
  }
}

/* ── Admin Premium Responsive Theme ─────────────────────────────────────── */

:root {
  --adm-bg: #eef3fb;
  --adm-surface: #ffffff;
  --adm-surface-2: #f8faff;
  --adm-border: #d7e2f1;
  --adm-ink: #0f172a;
  --adm-muted: #64748b;
  --adm-primary: #1d4ed8;
  --adm-primary-soft: #dbeafe;
  --adm-shadow: 0 14px 34px rgba(15, 23, 42, 0.1);
}

body {
  background:
    radial-gradient(circle at 0% 0%, #dde9ff 0%, transparent 32%),
    radial-gradient(circle at 100% 100%, #e6f0ff 0%, transparent 38%),
    var(--adm-bg);
}

.app {
  max-width: 1360px;
  margin: 18px auto 26px;
}

#adminView {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid var(--adm-border);
  border-radius: 20px;
  box-shadow: var(--adm-shadow);
  padding: 14px;
}

#adminView .topbar {
  border: 1px solid var(--adm-border);
  border-radius: 16px;
  background: linear-gradient(120deg, #ffffff 0%, #f4f8ff 100%);
  padding: 14px 16px;
}

#adminView .topbar-kicker {
  color: #0b4fd6;
  border-color: #cfe0ff;
  background: #ecf3ff;
}

#adminView h2 {
  color: var(--adm-ink);
  letter-spacing: -0.01em;
}

#adminView .toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin: 12px 0;
  padding: 10px;
  border: 1px solid var(--adm-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(6px);
}

#adminView .toolbar input {
  border: 1px solid #cfdbed;
  border-radius: 12px;
  background: #ffffff;
  color: var(--adm-ink);
  min-height: 42px;
}

#adminView button {
  min-height: 40px;
  border-radius: 11px;
}

#adminView button.ghost {
  border: 1px solid #cfdbed;
  background: #ffffff;
  color: #1e293b;
}

#adminView .table-wrap {
  border: 1px solid var(--adm-border);
  border-radius: 14px;
  background: var(--adm-surface);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

#adminView table {
  min-width: 760px;
}

#adminView th {
  background: linear-gradient(180deg, #f7faff, #eef4ff);
  color: #334155;
  border-bottom: 1px solid var(--adm-border);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#adminView td {
  color: #1f2937;
  border-bottom: 1px solid #eaf0f8;
}

#adminView tbody tr:hover {
  background: #f5f9ff;
}

#adminView .row-link-btn {
  color: #0f172a;
  text-decoration-color: #9db9ef;
  text-decoration-thickness: 2px;
}

#adminView .row-link-btn:hover {
  color: var(--adm-primary);
  text-decoration-color: var(--adm-primary);
}

#adminView .case-card {
  border: 1px solid var(--adm-border);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--adm-surface) 0%, var(--adm-surface-2) 100%);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
}

#adminView .case-head h3 {
  margin-bottom: 4px;
  color: var(--adm-ink);
}

#adminView .meta {
  color: var(--adm-muted);
}

#adminView .case-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

#adminView .case-summary-card {
  border: 1px solid var(--adm-border);
  border-radius: 13px;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

#adminView .case-summary-card.active {
  border-color: #9fbcf4;
  box-shadow: 0 0 0 2px #e5efff, 0 10px 20px rgba(29, 78, 216, 0.12);
  background: #f8fbff;
}

#adminView .case-summary-top span {
  color: var(--adm-primary);
}

#adminView .case-detail-page {
  background: #fff;
  border: 1px solid var(--adm-border);
  border-radius: 16px;
  overflow: hidden;
}

#adminView .case-detail-topbar {
  background: linear-gradient(100deg, #0f172a, #1e293b);
  padding: 10px 12px;
}

#adminView .case-detail-body {
  padding: 12px;
  gap: 12px;
}

#adminView .detail-card {
  border: 1px solid #dde7f4;
  border-radius: 12px;
  background: #fff;
}

#adminView .photo-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
}

#adminView .photo-thumb,
#adminView .photo-grid img {
  height: 160px;
}

#adminView .edit-case-panel {
  border: 1px solid #d8e4f5;
  border-radius: 14px;
  background: #fbfdff;
}

#adminView .edit-form-grid {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

#adminView .edit-label-full {
  grid-column: 1 / -1;
}

@media (max-width: 1024px) {
  #adminView {
    padding: 12px;
  }

  #adminView .case-dashboard-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

@media (max-width: 760px) {
  .app {
    margin: 8px auto 14px;
    padding: 0 8px;
  }

  #adminView {
    padding: 8px;
    border-radius: 14px;
  }

  #adminView .topbar {
    grid-template-columns: 1fr;
    display: grid;
    gap: 10px;
    padding: 12px;
  }

  #adminView .toolbar {
    grid-template-columns: 1fr;
  }

  #adminView .toolbar button,
  #adminView .toolbar input {
    width: 100%;
  }

  #adminView .table-wrap {
    overflow-x: auto;
  }

  #adminView .case-head {
    display: grid;
    gap: 8px;
  }

  #adminView .case-actions {
    width: 100%;
    justify-items: stretch;
  }

  #adminView .case-actions .ghost,
  #adminView .case-detail-actions button,
  #adminView .back-btn {
    width: 100%;
  }

  #adminView .case-detail-topbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    align-items: stretch;
  }

  #adminView .case-detail-label strong,
  #adminView .case-detail-label .muted {
    white-space: normal;
  }

  #adminView .case-detail-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
  }

  #adminView .edit-form-grid {
    grid-template-columns: 1fr;
  }

  #adminView .photo-grid {
    grid-template-columns: 1fr;
  }
}

/* ── iOS Glass Theme Override ───────────────────────────────────────────── */

:root {
  --ios-bg: #e9eef7;
  --ios-ink: #0f172a;
  --ios-muted: #5b6b82;
  --ios-primary: #007aff;
  --ios-primary-soft: rgba(0, 122, 255, 0.16);
  --ios-glass: rgba(255, 255, 255, 0.58);
  --ios-glass-strong: rgba(255, 255, 255, 0.78);
  --ios-border: rgba(255, 255, 255, 0.66);
  --ios-shadow: 0 18px 34px rgba(18, 35, 67, 0.12);
}

body {
  background:
    radial-gradient(1200px 600px at 5% -10%, #ffffff 0%, transparent 60%),
    radial-gradient(1200px 700px at 100% 100%, #d8e6ff 0%, transparent 55%),
    linear-gradient(145deg, #e8eef8 0%, #dde8f7 100%);
}

.bg-noise {
  opacity: 0.08;
  background-image: radial-gradient(#0f172a18 1px, transparent 1px);
}

#adminView,
.login-panel {
  background: var(--ios-glass);
  border: 1px solid var(--ios-border);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  box-shadow: var(--ios-shadow);
}

#adminView .topbar {
  background: var(--ios-glass-strong);
  border: 1px solid var(--ios-border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}

#adminView .topbar h2,
#adminView .topbar-head .muted {
  color: var(--ios-ink);
}

#adminView .topbar-kicker {
  color: #0b63d8;
  background: rgba(255,255,255,0.74);
  border: 1px solid rgba(255,255,255,0.75);
}

#adminView .toolbar {
  background: var(--ios-glass-strong);
  border: 1px solid var(--ios-border);
  box-shadow: 0 10px 22px rgba(18, 35, 67, 0.08);
}

#adminView .toolbar input {
  border: 1px solid rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.85);
  color: var(--ios-ink);
}

#adminView button:not(.case-summary-body):not(.case-delete-btn):not(.client-action-btn):not(.trash-icon-btn) {
  background: linear-gradient(180deg, #2f8dff 0%, #007aff 100%);
  border: 1px solid rgba(255,255,255,0.4);
  box-shadow: 0 8px 16px rgba(0, 122, 255, 0.28);
}

#adminView button:hover {
  filter: saturate(1.07);
}

#adminView button.ghost {
  background: rgba(255,255,255,0.74);
  border: 1px solid rgba(255,255,255,0.88);
  color: var(--ios-ink);
  box-shadow: 0 6px 14px rgba(18, 35, 67, 0.08);
}

#adminView .table-wrap,
#adminView .case-card,
#adminView .case-detail-page,
#adminView .detail-card,
#adminView .edit-case-panel,
#adminView .photo-card,
#adminView .attachment-card {
  background: var(--ios-glass-strong);
  border: 1px solid var(--ios-border);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 10px 22px rgba(18, 35, 67, 0.08);
}

#adminView th {
  background: rgba(255,255,255,0.76);
  color: #2a3a55;
  border-bottom: 1px solid rgba(255,255,255,0.85);
}

#adminView td {
  border-bottom: 1px solid rgba(255,255,255,0.7);
  color: #1f2b43;
}

#adminView tbody tr:hover {
  background: rgba(255,255,255,0.52);
}

#adminView .row-link-btn {
  color: #0f2f6d;
  text-decoration-color: rgba(15,47,109,0.35);
}

#adminView .row-link-btn:hover {
  color: var(--ios-primary);
  text-decoration-color: var(--ios-primary);
}

#adminView .case-summary-card {
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(255,255,255,0.85);
}

#adminView .case-summary-card.active {
  border-color: rgba(0,122,255,0.38);
  box-shadow: 0 0 0 2px rgba(0,122,255,0.16), 0 10px 18px rgba(18,35,67,0.12);
  background: rgba(236, 245, 255, 0.9);
}

#adminView .case-summary-top span,
#adminView .case-badge,
#adminView .owner-stat strong {
  color: var(--ios-primary);
}

#adminView .case-badge {
  background: var(--ios-primary-soft);
}

#adminView .case-detail-topbar {
  background: linear-gradient(180deg, rgba(255,255,255,0.58) 0%, rgba(245,249,255,0.58) 100%);
  border-bottom: 1px solid rgba(255,255,255,0.7);
}

#adminView .case-detail-label strong,
#adminView .case-detail-label .muted {
  color: var(--ios-ink);
}

#adminView .case-detail-actions button,
#adminView .back-btn {
  background: rgba(255,255,255,0.8);
  color: var(--ios-ink);
  border: 1px solid rgba(255,255,255,0.95);
  box-shadow: 0 6px 14px rgba(18, 35, 67, 0.08);
}

#adminView .case-detail-actions button.danger-ghost {
  background: rgba(255, 59, 48, 0.14);
  border-color: rgba(255, 59, 48, 0.35);
  color: #b3261e;
}

#adminView .muted,
#adminView .meta,
#adminView .attachment-meta,
#adminView .room-metrics,
#adminView .room-materials,
#adminView .photo-caption {
  color: var(--ios-muted);
}

@media (max-width: 760px) {
  #adminView,
  .login-panel {
    backdrop-filter: blur(14px) saturate(1.2);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
  }

  #adminView .topbar,
  #adminView .toolbar {
    border-radius: 12px;
  }

  #adminView .toolbar {
    gap: 8px;
  }
}

/* ── iOS Menus Final Override ───────────────────────────────────────────── */

#adminView,
.login-panel {
  background: rgba(231, 238, 248, 0.62) !important;
  border: 1px solid rgba(214, 225, 240, 0.9) !important;
  box-shadow: 0 22px 38px rgba(15, 23, 42, 0.14) !important;
}

#adminView .topbar,
#adminView .toolbar,
#adminView .case-head,
#adminView .case-detail-topbar {
  background: rgba(226, 235, 247, 0.72) !important;
  border: 1px solid rgba(208, 220, 238, 0.95) !important;
  backdrop-filter: blur(20px) saturate(1.2) !important;
  -webkit-backdrop-filter: blur(20px) saturate(1.2) !important;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.1) !important;
}

#adminView .topbar-kicker {
  background: rgba(227, 238, 255, 0.92) !important;
  color: #0a63d7 !important;
}

#adminView .toolbar input,
#adminView input,
#adminView textarea,
#adminView select {
  background: rgba(238, 244, 252, 0.86) !important;
  border: 1px solid rgba(206, 219, 238, 0.94) !important;
  color: #0f172a !important;
}

#adminView button:not(.case-summary-body):not(.case-delete-btn):not(.client-action-btn):not(.trash-icon-btn) {
  background: linear-gradient(180deg, #1b84ff 0%, #007aff 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.48) !important;
  box-shadow: 0 8px 16px rgba(0, 122, 255, 0.24) !important;
}

#adminView button.ghost,
#adminView .case-detail-actions button,
#adminView .back-btn,
#adminView .photo-link.ghost-link {
  background: rgba(230, 238, 249, 0.86) !important;
  color: #0f172a !important;
  border: 1px solid rgba(206, 219, 238, 0.95) !important;
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.08) !important;
}

#adminView .table-wrap,
#adminView .case-card,
#adminView .case-detail-page,
#adminView .detail-card,
#adminView .edit-case-panel,
#adminView .photo-card,
#adminView .attachment-card,
#adminView .stats-strip .stat-chip,
#adminView .owner-stat {
  background: rgba(227, 236, 248, 0.76) !important;
  border: 1px solid rgba(205, 217, 236, 0.94) !important;
  backdrop-filter: blur(16px) saturate(1.18) !important;
  -webkit-backdrop-filter: blur(16px) saturate(1.18) !important;
}

#adminView th {
  background: rgba(223, 233, 247, 0.86) !important;
  color: #334155 !important;
}

#adminView td {
  color: #1f2937 !important;
}

#adminView .case-summary-card {
  background: rgba(223, 234, 249, 0.82) !important;
}

#adminView .case-summary-card.active {
  background: rgba(236, 245, 255, 0.92) !important;
  border-color: rgba(0, 122, 255, 0.35) !important;
}

#adminView .muted,
#adminView .meta,
#adminView .attachment-meta,
#adminView .photo-caption,
#adminView .room-metrics,
#adminView .room-materials {
  color: #5c6c83 !important;
}

/* evitar que botones de navegación tipo fila/caso queden azules */
#adminView button:not(.row-link-btn):not(.client-name-btn):not(.case-summary-body):not(.case-delete-btn):not(.case-summary-card):not(.ghost):not(.detail-action-btn):not(.back-btn):not(.client-action-btn):not(.trash-icon-btn) {
  background: linear-gradient(180deg, #1b84ff 0%, #007aff 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.48) !important;
  box-shadow: 0 8px 16px rgba(0, 122, 255, 0.24) !important;
}

#adminView button.client-name-btn,
#adminView button.client-name-btn:hover,
#adminView button.client-name-btn:focus {
  background: transparent !important;
  color: #0f172a !important;
  border: 0 !important;
  box-shadow: none !important;
  filter: none !important;
  transform: none !important;
}

/* ── Tab overrides: neutrales inactivos, color único por tab activo ─────── */
#adminView .tabs button {
  background: rgba(255,255,255,0.35) !important;
  color: #334155 !important;
  border: 1px solid rgba(200,215,235,0.7) !important;
  box-shadow: none !important;
}
#adminView .tabs button:hover {
  background: rgba(255,255,255,0.6) !important;
}
/* Clientes → verde */
#adminView #tabClients.active {
  background: linear-gradient(135deg, #16a34a, #15803d) !important;
  color: #fff !important;
  border-color: transparent !important;
  box-shadow: 0 4px 12px rgba(21,128,61,0.35) !important;
}
/* Administradores → púrpura */
#adminView #tabAdmins.active {
  background: linear-gradient(135deg, #7c3aed, #6d28d9) !important;
  color: #fff !important;
  border-color: transparent !important;
  box-shadow: 0 4px 12px rgba(109,40,217,0.35) !important;
}
/* Eliminados → rojo */
#adminView #tabDeleted.active {
  background: linear-gradient(135deg, #dc2626, #b91c1c) !important;
  color: #fff !important;
  border-color: transparent !important;
  box-shadow: 0 4px 12px rgba(185,28,28,0.35) !important;
}

#adminView .clients-excel-table {
  border-collapse: collapse;
  width: 100%;
  background: #ffffff;
}

#adminView .clients-excel-table th,
#adminView .clients-excel-table td {
  border: 1px solid #dbe4f0;
  padding: 10px 12px;
  vertical-align: top;
}

#adminView .clients-excel-table th {
  background: #eef3fb !important;
  color: #334155 !important;
  font-weight: 700;
}

#adminView .clients-excel-table tbody tr:hover {
  background: #f8fbff;
}

#adminView .row-link-btn {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: #0f2f6d !important;
  padding: 0 !important;
  min-height: auto !important;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

#adminView .row-link-btn:hover {
  background: transparent !important;
  box-shadow: none !important;
  color: #007aff !important;
  transform: none !important;
  filter: none !important;
}

#adminView .case-summary-card {
  background: rgba(255, 255, 255, 0.78) !important;
  border: 1px solid rgba(255, 255, 255, 0.88) !important;
  box-shadow: 0 8px 14px rgba(15, 23, 42, 0.08) !important;
  color: #0f172a !important;
}

#adminView .case-summary-card:hover {
  background: rgba(255, 255, 255, 0.88) !important;
  border-color: rgba(0, 122, 255, 0.28) !important;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.1) !important;
}

#adminView .case-summary-card.active {
  background: rgba(236, 245, 255, 0.92) !important;
  border-color: rgba(0, 122, 255, 0.35) !important;
  box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.14), 0 10px 18px rgba(15, 23, 42, 0.1) !important;
}

/* menu de detalle mejor ordenado */
#adminView .case-detail-topbar {
  display: grid !important;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  align-items: center;
  gap: 10px;
}

#adminView .case-detail-label {
  min-width: 0;
  padding: 2px 4px;
}

#adminView .case-detail-label strong {
  font-size: 28px;
  letter-spacing: -0.01em;
  font-family: "Sora", "Manrope", sans-serif;
}

#adminView .case-detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

#adminView .action-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 13px;
  background: rgba(220, 231, 247, 0.68);
  border: 1px solid rgba(196, 212, 236, 0.88);
}

#adminView .action-group--primary {
  background: rgba(203, 224, 252, 0.68);
  border-color: rgba(156, 189, 241, 0.86);
}

#adminView .detail-action-btn {
  min-height: 36px !important;
  padding: 7px 12px !important;
  border-radius: 10px !important;
  background: rgba(228, 238, 252, 0.9) !important;
  color: #0f172a !important;
  border: 1px solid rgba(202, 216, 238, 0.95) !important;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.07) !important;
  font-size: 13px;
  font-weight: 700;
}

#adminView .detail-action-btn.is-primary {
  background: linear-gradient(180deg, #1b84ff 0%, #007aff 100%) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.45) !important;
  box-shadow: 0 8px 16px rgba(0, 122, 255, 0.24) !important;
}

#adminView .detail-action-btn.is-danger {
  background: rgba(255, 69, 58, 0.15) !important;
  color: #a91f18 !important;
  border-color: rgba(255, 69, 58, 0.34) !important;
}

#adminView .back-btn.detail-action-btn {
  white-space: nowrap;
}

#adminView .detail-card {
  border-radius: 14px !important;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08) !important;
}

#adminView .detail-card h3,
#adminView .detail-card h4 {
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(186, 203, 226, 0.35);
}

@media (max-width: 980px) {
  #adminView .case-detail-topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  #adminView .case-detail-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  #adminView .action-group {
    width: 100%;
    justify-content: stretch;
    display: grid;
    grid-template-columns: 1fr;
  }

  #adminView .detail-action-btn {
    width: 100%;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   FULL RESPONSIVE — PC + Mobile (consolidated final layer)
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Large tablet / small laptop (≤1100px) ─────────────────────────────── */
@media (max-width: 1100px) {
  .app {
    max-width: 100%;
    margin: 12px auto;
    padding: 0 12px;
  }

  #adminView .case-dashboard-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

/* ── Tablet (≤900px) ────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .cases-workspace,
  .fb-shell {
    grid-template-columns: 1fr !important;
  }

  .cases-client-list {
    position: static !important;
    max-height: none !important;
  }

  .client-list-scroll {
    max-height: 46vh;
  }

  .case-layout {
    grid-template-columns: 1fr !important;
  }

  .owner-insights {
    grid-template-columns: 1fr !important;
  }

  #adminView .edit-form-grid {
    grid-template-columns: 1fr !important;
  }

  #adminView .photo-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) !important;
  }
}

/* ── Mobile (≤640px) ────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* App wrapper */
  .app {
    margin: 6px auto;
    padding: 0 6px;
  }

  /* Main panel */
  #adminView {
    padding: 8px !important;
    border-radius: 14px !important;
  }

  /* Topbar: stack title row + logout button */
  #adminView .topbar {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
    padding: 12px !important;
    border-radius: 12px !important;
  }

  #adminView .topbar h2 {
    font-size: 20px !important;
  }

  #adminView .topbar > button {
    width: 100% !important;
    min-height: 44px !important;
  }

  /* Toolbar: search + button stacked */
  #adminView .toolbar {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    padding: 8px !important;
    margin: 8px 0 !important;
  }

  #adminView .toolbar input,
  #adminView .toolbar button {
    width: 100% !important;
    min-height: 44px !important;
    font-size: 15px !important;
  }

  /* Table: horizontal scroll */
  .table-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  #adminView table {
    min-width: 600px !important;
    font-size: 13px;
  }

  #adminView th,
  #adminView td {
    padding: 8px 6px !important;
  }

  /* Stats strip: 2 cols */
  .stats-strip {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  /* Sidebar client list */
  .cases-client-list {
    padding: 10px !important;
    border-radius: 12px !important;
  }

  .client-list-scroll {
    max-height: 40vh;
  }

  .client-item {
    padding: 10px 12px !important;
    min-height: 44px;
  }

  /* Case cards */
  #adminView .case-dashboard-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  .case-summary-card {
    padding: 10px 12px !important;
    min-height: 48px;
  }

  /* Owner insights */
  .owner-insights {
    grid-template-columns: 1fr !important;
    padding: 10px !important;
  }

  .owner-stat-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Case head: stack */
  .case-head {
    display: grid !important;
    gap: 8px !important;
  }

  .case-badges {
    justify-content: flex-start !important;
  }

  .case-actions {
    justify-items: stretch !important;
    width: 100% !important;
  }

  /* Case detail topbar */
  #adminView .case-detail-topbar {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    padding: 10px 12px !important;
    border-radius: 12px 12px 0 0 !important;
  }

  #adminView .back-btn {
    width: 100% !important;
    min-height: 44px !important;
    text-align: center !important;
  }

  #adminView .case-detail-label strong {
    white-space: normal !important;
    font-size: 14px;
  }

  #adminView .case-detail-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
    width: 100% !important;
  }

  #adminView .case-detail-actions button {
    min-height: 44px !important;
    width: 100% !important;
  }

  /* Detail action groups */
  .detail-action-group {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  #adminView .action-group {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    width: 100% !important;
  }

  #adminView .action-group--primary {
    grid-template-columns: 1fr 1fr !important;
  }

  #adminView .detail-action-btn {
    min-height: 44px !important;
    width: 100% !important;
    font-size: 13px !important;
    padding: 8px 6px !important;
  }

  /* Photo grid */
  #adminView .photo-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
  }

  .photo-grid img,
  .photo-thumb {
    height: 110px !important;
  }

  /* Edit form */
  #adminView .edit-form-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .edit-form-actions {
    flex-direction: column !important;
    gap: 8px !important;
  }

  .edit-form-actions button {
    width: 100% !important;
    min-height: 44px !important;
  }

  /* Case detail body */
  #adminView .case-detail-body {
    padding: 10px 8px !important;
    gap: 10px !important;
  }

  /* Detail card */
  #adminView .detail-card {
    padding: 12px !important;
    border-radius: 10px !important;
  }

  /* Row actions */
  .row-actions {
    flex-direction: column !important;
    gap: 6px !important;
  }

  .row-actions button {
    min-height: 40px !important;
  }

  /* Case action buttons */
  .case-action-btns {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
  }

  .case-pdf-btn,
  .case-edit-btn,
  .case-delete-btn {
    text-align: center !important;
    min-height: 40px !important;
  }
}

/* ── Small mobile (≤420px) ──────────────────────────────────────────────── */
@media (max-width: 420px) {
  /* Single col everywhere that was 2 */
  .stats-strip {
    grid-template-columns: 1fr !important;
  }

  .owner-stat-grid {
    grid-template-columns: 1fr !important;
  }

  #adminView .case-detail-actions {
    grid-template-columns: 1fr !important;
  }

  .case-action-btns {
    grid-template-columns: 1fr !important;
  }

  #adminView .action-group {
    grid-template-columns: 1fr 1fr !important;
  }

  #adminView .photo-grid {
    grid-template-columns: 1fr !important;
  }

  .photo-grid img,
  .photo-thumb {
    height: 180px !important;
  }

  #adminView table {
    font-size: 12px;
  }

  #adminView th,
  #adminView td {
    padding: 7px 5px !important;
  }

  /* Login panel */
  .login-panel {
    margin: 20px auto !important;
    padding: 18px !important;
  }
}



/* -- PDF Modal Overlay --------------------------------------------------- */
#_pdf_overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  flex-direction: column;
  background: #111827;
  -webkit-overflow-scrolling: touch;
}

#_pdf_overlay ._pdf_bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  background: #0f172a;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  flex-shrink: 0;
  min-height: 52px;
}

#_pdf_overlay ._pdf_bar_title {
  color: #e2e8f0;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#_pdf_overlay ._pdf_bar_btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.22);
  color: #e2e8f0;
  border-radius: 10px;
  padding: 8px 18px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  min-height: 44px;
  flex-shrink: 0;
  transition: background 0.15s;
}

#_pdf_overlay ._pdf_bar_btn:hover {
  background: rgba(255,255,255,0.22);
}

#_pdf_frame {
  flex: 1;
  width: 100%;
  border: none;
  background: #6b6b6b;
  display: block;
}

/* -- Budget Preview Modal ----------------------------------------------- */
#_budget_overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(8, 14, 28, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
}

._budget_panel {
  width: min(1100px, 96vw);
  max-height: 92vh;
  overflow: hidden;
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e8dcc7;
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
}

._budget_head,
._budget_actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid #f0e6d3;
  background: linear-gradient(135deg, #fffaf2, #fff3df);
}

._budget_actions {
  border-top: 1px solid #f0e6d3;
  border-bottom: 0;
}

._budget_title {
  font-family: "Sora", "Manrope", sans-serif;
  font-size: 1rem;
  font-weight: 700;
}

._budget_sub {
  margin-top: 2px;
  color: #6f6658;
  font-size: 0.86rem;
}

._budget_body {
  padding: 12px;
  overflow: auto;
  display: grid;
  gap: 12px;
}

._budget_controls {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

._budget_controls label {
  display: grid;
  gap: 6px;
  font-size: 0.85rem;
  color: #3b2f1f;
}

._budget_controls input {
  width: 120px;
}

._budget_btn {
  border: 1px solid #d7c8af;
  background: #fff;
  color: #2f2518;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

._budget_btn_primary {
  background: linear-gradient(135deg, #9b2226, #ca6702);
  color: #fff;
  border-color: transparent;
}

._budget_kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
}

._budget_kpi {
  border: 1px solid #ead8bd;
  border-radius: 10px;
  background: #fff9ef;
  padding: 10px;
  display: grid;
  gap: 4px;
}

._budget_kpi small {
  color: #7a6b57;
}

._budget_kpi strong {
  font-size: 1rem;
}

._budget_table_wrap {
  border: 1px solid #e7d7bc;
  border-radius: 10px;
  overflow: auto;
}

._budget_table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

._budget_table th,
._budget_table td {
  border-bottom: 1px solid #efe1ca;
  padding: 8px 9px;
  text-align: left;
  vertical-align: top;
}

._budget_table th {
  background: #fff5e7;
  font-size: 0.82rem;
}

._budget_note {
  margin: 0;
  font-size: 0.82rem;
  color: #6f6658;
}

/* ── DNI Modal ──────────────────────────────────────────────────────────── */

.dni-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
}

.dni-modal.hidden {
  display: none !important;
}

.dni-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.dni-modal-content {
  position: relative;
  z-index: 1;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.35);
  width: 100%;
  max-width: 700px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dni-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(135deg, #f9fafb, #f3f4f6);
}

.dni-modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #1f2937;
  font-family: "Sora", "Manrope", sans-serif;
}

.dni-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6b7280;
  padding: 4px;
  min-width: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.15s;
}

.dni-modal-close:hover {
  background: #e5e7eb;
  color: #1f2937;
}

.dni-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.dni-image-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.dni-image-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dni-image-section h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.dni-image {
  width: 100%;
  height: auto;
  max-height: 400px;
  object-fit: contain;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  background: #f9fafb;
  display: block;
}

@media (max-width: 640px) {
  .dni-modal {
    padding: 12px;
  }

  .dni-modal-content {
    max-width: 100%;
    border-radius: 14px;
  }

  .dni-modal-header {
    padding: 12px 14px;
  }

  .dni-modal-header h3 {
    font-size: 0.95rem;
  }

  .dni-modal-body {
    padding: 14px;
  }

  .dni-image-container {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .dni-image {
    max-height: 360px;
  }
}

.photo-modal {
  position: fixed;
  inset: 0;
  z-index: 2200;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.photo-modal.hidden {
  display: none !important;
}

.photo-modal-image {
  max-width: min(92vw, 1500px);
  max-height: 86vh;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
  border: 0;
  outline: 0;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  border-radius: 12px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.55);
  background: rgba(255, 255, 255, 0.04);
}

.photo-modal-image:focus,
.photo-modal-image:active,
.photo-modal a:focus,
.photo-modal a:active {
  outline: 0;
  text-decoration: none;
}

.photo-modal-close {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.photo-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.38);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.photo-nav-prev {
  left: 18px;
}

.photo-nav-next {
  right: 18px;
}

.photo-modal-counter {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
}

.photo-thumb {
  cursor: zoom-in;
}

