:root {
  --bg: #09090b;
  --panel: #18181b;
  --panel-2: rgba(24,24,27,0.6);
  --border: #27272a;
  --border-2: #3f3f46;
  --text: #f4f4f5;
  --text-dim: #a1a1aa;
  --text-dim2: #71717a;
  --text-dim3: #52525b;
  --amber: #f59e0b;
  --amber-dim: rgba(245,158,11,0.1);
  --amber-border: rgba(245,158,11,0.3);
  --red: #f87171;
  --red-dim: rgba(248,113,113,0.1);
  --red-border: rgba(248,113,113,0.25);
  --green: #34d399;
  --green-dim: rgba(52,211,153,0.12);
  --green-border: rgba(52,211,153,0.3);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  min-height: 100vh;
}

.font-display { font-family: 'Space Grotesk', system-ui, sans-serif; }
.font-mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 4px; }

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* ---------------- Login ---------------- */

.login-body {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 340px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 16px; padding: 32px 28px; text-align: center;
}
.login-logo {
  width: 52px; height: 52px; border-radius: 14px; background: var(--amber-dim);
  color: var(--amber); display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.login-card h1 { font-family: 'Space Grotesk', sans-serif; margin: 0 0 2px; font-size: 22px; }
.login-sub { color: var(--text-dim2); font-size: 13px; margin: 0 0 20px; }
.login-error { color: var(--red); font-size: 13px; margin: 0 0 12px; }
.login-card input {
  width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 14px; color: var(--text); font-size: 14px; margin-bottom: 14px; outline: none;
}
.login-card input:focus { border-color: var(--amber-border); }
.login-card button {
  width: 100%; background: var(--amber); color: #09090b; border: none; border-radius: 10px;
  padding: 11px; font-weight: 600; font-size: 14px;
}
.login-card button:hover { background: #fbbf24; }

/* ---------------- Layout ---------------- */

#app { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
@media (max-width: 860px) { #app { grid-template-columns: 1fr; } }

.sidebar {
  border-right: 1px solid #18181b; background: rgba(9,9,11,0.6);
  min-height: 100vh;
}
@media (max-width: 860px) {
  .sidebar { display: none; position: fixed; inset: 0; z-index: 40; background: var(--bg); }
  .sidebar.open { display: block; }
}
.sidebar-head {
  padding: 20px; border-bottom: 1px solid #18181b; display: flex; align-items: center; justify-content: space-between;
}
.sidebar-head h1 { font-size: 17px; margin: 0; font-weight: 700; }
.sidebar-head p { font-size: 12px; color: var(--text-dim3); margin: 2px 0 0; }
.sidebar-close { display: none; background: none; border: none; color: var(--text-dim2); }
@media (max-width: 860px) { .sidebar-close { display: block; } }

.vehicle-list { padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.vehicle-item {
  display: flex; align-items: center; gap: 12px; border-radius: 12px; padding: 10px 12px;
  background: transparent; border: 1px solid transparent; text-align: left; width: 100%;
}
.vehicle-item:hover { background: #18181b; }
.vehicle-item.active { background: var(--amber-dim); border-color: var(--amber-border); }
.vehicle-icon {
  width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: #18181b; color: var(--text-dim2); flex-shrink: 0;
}
.vehicle-item.active .vehicle-icon { background: rgba(245,158,11,0.2); color: var(--amber); }
.vehicle-info { flex: 1; min-width: 0; }
.vehicle-info .v-name { display: block; font-size: 14px; font-weight: 500; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vehicle-item.active .v-name { color: var(--text); }
.vehicle-info .v-sub { display: block; font-size: 12px; color: var(--text-dim3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-foot { padding: 12px; }

.session-info { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid #18181b; }
.session-role { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; }
.session-role.admin { background: var(--green-dim); color: var(--green); }
.session-logout { font-size: 12px; color: var(--text-dim3); text-decoration: none; }
.session-logout:hover { color: var(--red); text-decoration: underline; }

.main { min-width: 0; }
.mobile-topbar { display: none; padding: 12px 16px; border-bottom: 1px solid #18181b; }
@media (max-width: 860px) { .mobile-topbar { display: flex; align-items: center; } }
.mobile-topbar button { background: none; border: none; color: var(--text-dim); display: flex; align-items: center; gap: 8px; font-size: 14px; }

.content { padding: 24px; max-width: 980px; }
.content-wide { max-width: 1400px; }
@media (max-width: 640px) { .content { padding: 16px; } }

.content-grid { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
.content-main { min-width: 0; }
.content-charts { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 24px; }
@media (max-width: 1180px) {
  .content-grid { grid-template-columns: 1fr; }
  .content-charts { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
}
@media (max-width: 560px) {
  .content-charts { grid-template-columns: 1fr; }
}

.chart-card { background: var(--panel-2); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.chart-card h3 { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-dim2); margin: 0 0 12px; text-transform: uppercase; letter-spacing: 0.03em; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-sub { margin-top: 8px; font-size: 11px; color: var(--text-dim3); font-family: 'JetBrains Mono', monospace; text-align: center; }
.chart-empty { font-size: 12px; color: var(--text-dim3); text-align: center; padding: 30px 0; }
.chart-legend { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; font-size: 11px; color: var(--text-dim2); }
.chart-legend .dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; margin-right: 6px; }

.conn-counter { font-family: 'Space Grotesk', sans-serif; font-size: 30px; font-weight: 700; color: var(--amber); text-align: center; line-height: 1; }
.conn-counter-label { text-align: center; font-size: 11px; color: var(--text-dim3); margin: 4px 0 12px; }
.conn-list { display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow-y: auto; }
.conn-row { padding: 8px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; }
.conn-who { display: flex; align-items: center; gap: 6px; }
.conn-name { font-size: 12.5px; color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn-meta { font-size: 10.5px; color: var(--text-dim3); margin-top: 2px; font-family: 'JetBrains Mono', monospace; }

/* ---------------- Buttons ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 10px; padding: 9px 16px; font-size: 14px; font-weight: 500; border: none;
  transition: background .15s, color .15s;
}
.btn-primary { background: var(--amber); color: #09090b; }
.btn-primary:hover { background: #fbbf24; }
.btn-outline { background: transparent; border: 1px solid var(--border-2); color: var(--text-dim); }
.btn-outline:hover { background: #18181b; }
.btn-ghost { background: transparent; color: var(--text-dim2); }
.btn-ghost:hover { background: #18181b; color: var(--text); }
.btn-danger { background: #ef4444; color: white; }
.btn-danger:hover { background: #f87171; }
.icon-btn { background: none; border: none; color: var(--text-dim3); padding: 6px; border-radius: 8px; display: inline-flex; }
.icon-btn:hover { background: #27272a; color: var(--amber); }
.icon-btn.danger:hover { color: var(--red); }

/* ---------------- Empty state ---------------- */

.empty-hero { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 70vh; padding: 24px; }
.empty-hero .icon-wrap { width: 64px; height: 64px; border-radius: 18px; background: #18181b; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--amber); margin-bottom: 16px; }
.empty-hero h2 { font-family: 'Space Grotesk', sans-serif; font-size: 20px; margin: 0 0 6px; }
.empty-hero p { color: var(--text-dim2); font-size: 14px; max-width: 320px; margin: 0 0 20px; }

.empty-box { border: 1px dashed var(--border-2); border-radius: 14px; padding: 40px 24px; text-align: center; }
.empty-box p { color: var(--text-dim2); font-size: 14px; max-width: 380px; margin: 0 auto; }

/* ---------------- Vehicle header ---------------- */

.veh-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.veh-eyebrow { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--amber); }
.veh-plate { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-dim); border: 1px solid var(--border); border-radius: 5px; padding: 2px 6px; margin-left: 8px; }
.veh-header h1 { font-family: 'Space Grotesk', sans-serif; font-size: 28px; font-weight: 700; margin: 2px 0 0; }
.veh-age { font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 500; color: var(--text-dim); background: #18181b; border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; vertical-align: middle; }
.veh-actions { display: flex; align-items: center; gap: 10px; }

.odometer { display: inline-flex; align-items: center; gap: 2px; background: black; border-radius: 8px; padding: 6px 8px; border: 1px solid var(--border); }
.odometer .digit {
  font-family: 'JetBrains Mono', monospace; font-size: 22px; color: var(--amber);
  background: #18181b; border-radius: 3px; width: 1.15em; text-align: center; padding: 4px 0;
  text-shadow: 0 0 8px rgba(245,158,11,0.55);
}
.odometer .unit { margin-left: 8px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim3); font-weight: 600; }

/* ---------------- Stat cards ---------------- */

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 28px; }
@media (min-width: 900px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-card { background: var(--panel-2); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.stat-label { display: flex; align-items: center; gap: 6px; color: var(--text-dim3); font-size: 12px; margin-bottom: 6px; }
.stat-value { font-family: 'Space Grotesk', sans-serif; font-size: 21px; font-weight: 700; }
.stat-value.amber { color: var(--amber); }
.stat-value.green { color: var(--green); }
.stat-value.red { color: var(--red); }

/* ---------------- Tabs ---------------- */

.tabs { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid #18181b; margin-bottom: 20px; }
.tab-btn {
  display: flex; align-items: center; gap: 6px; padding: 10px 14px; font-size: 14px; font-weight: 500;
  background: none; border: none; border-bottom: 2px solid transparent; color: var(--text-dim3); margin-bottom: -1px;
}
.tab-btn.active { border-color: var(--amber); color: var(--amber); }

/* ---------------- Entries list ---------------- */

.section-actions { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.entries-list { border: 1px solid #18181b; border-radius: 14px; overflow: hidden; }
.entry-row {
  display: flex; align-items: center; gap: 16px; padding: 12px 16px; border-top: 1px solid #18181b; cursor: pointer;
}
.entry-row:first-child { border-top: none; }
.entry-row:hover { background: rgba(24,24,27,0.5); }
.entry-row:hover .entry-actions { opacity: 1; }
.entry-date { width: 90px; flex-shrink: 0; font-size: 12px; color: var(--text-dim3); font-family: 'JetBrains Mono', monospace; }
.entry-kind { width: 100px; flex-shrink: 0; }
.badge { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 8px; border-radius: 999px; border: 1px solid; }
.badge.entretien { background: var(--amber-dim); color: var(--amber); border-color: var(--amber-border); }
.badge.reparation { background: var(--red-dim); color: var(--red); border-color: var(--red-border); }
.entry-title { flex: 1; min-width: 0; }
.entry-title .t { font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-title .ref { font-size: 12px; color: var(--text-dim3); font-family: 'JetBrains Mono', monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-km { width: 90px; flex-shrink: 0; font-size: 12px; color: var(--text-dim2); font-family: 'JetBrains Mono', monospace; }
.entry-price { width: 90px; flex-shrink: 0; font-size: 14px; font-weight: 600; font-family: 'JetBrains Mono', monospace; }
.entry-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .15s; flex-shrink: 0; }
@media (max-width: 700px) {
  .entry-row { flex-wrap: wrap; }
  .entry-actions { opacity: 1; margin-left: auto; }
}

.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 16px; font-size: 12px; color: var(--text-dim2); }
.legend .dot { display: inline-block; width: 8px; height: 8px; border-radius: 999px; margin-right: 6px; }

/* ---------------- Reminders ---------------- */

.reminder-list { display: flex; flex-direction: column; gap: 10px; }
.reminder-row { display: flex; align-items: center; gap: 16px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 14px; padding: 12px 16px; }
.reminder-info { flex: 1; min-width: 0; }
.reminder-info .r-label { font-size: 14px; font-weight: 500; margin-right: 8px; }
.reminder-info .r-sub { font-size: 12px; color: var(--text-dim3); margin-top: 2px; }
.pill { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; padding: 3px 8px; border-radius: 999px; border: 1px solid; }
.pill.overdue { background: var(--red-dim); color: var(--red); border-color: var(--red-border); }
.pill.soon { background: var(--amber-dim); color: var(--amber); border-color: var(--amber-border); }
.pill.ok { background: var(--green-dim); color: var(--green); border-color: var(--green-border); }
.pill.info { background: rgba(113,113,122,0.12); color: var(--text-dim2); border-color: var(--border-2); }
.reminder-eta { text-align: right; flex-shrink: 0; font-size: 12px; font-family: 'JetBrains Mono', monospace; color: var(--text-dim3); }
.reminder-eta .over { color: var(--red); }
.reminder-actions { display: flex; gap: 2px; flex-shrink: 0; }
@media (max-width: 700px) { .reminder-eta { display: none; } }

/* ---------------- Infos tab ---------------- */

.info-card { background: var(--panel-2); border: 1px solid var(--border); border-radius: 14px; padding: 20px; max-width: 480px; }
.info-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid #18181b; font-size: 14px; }
.info-row dt { color: var(--text-dim3); }
.info-row dd { margin: 0; font-family: 'JetBrains Mono', monospace; color: var(--text); }
.info-notes { padding-top: 10px; font-size: 14px; }
.info-notes dt { color: var(--text-dim3); margin-bottom: 4px; }
.info-notes dd { margin: 0; white-space: pre-wrap; color: #d4d4d8; }
.info-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 16px; margin-top: 8px; border-top: 1px solid #18181b; }

/* ---------------- Modal ---------------- */

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal-box { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; width: 100%; max-width: 440px; max-height: 92vh; overflow-y: auto; box-shadow: 0 20px 50px rgba(0,0,0,0.5); }
.modal-box.wide { max-width: 620px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: rgba(24,24,27,0.97); backdrop-filter: blur(6px); }
.modal-head h3 { font-family: 'Space Grotesk', sans-serif; font-size: 17px; margin: 0; }
.modal-body { padding: 20px; }

.field { display: block; margin-bottom: 16px; }
.field .flabel { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim3); margin-bottom: 6px; }
.field .fhint { display: block; font-size: 12px; color: var(--text-dim3); margin-top: 4px; }
.field input[type=text], .field input[type=number], .field input[type=date], .field input[type=password], .field textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px;
  color: var(--text); font-size: 14px; outline: none;
}
.field input:focus, .field textarea:focus { border-color: rgba(245,158,11,0.5); box-shadow: 0 0 0 3px rgba(245,158,11,0.15); }
.field textarea { resize: vertical; font-family: inherit; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pick-grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(74px, 1fr)); gap: 8px; }
.pick-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.pick-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px; border-radius: 10px; border: 1px solid var(--border);
  padding: 10px 4px; font-size: 11px; background: none; color: var(--text-dim3);
}
.pick-btn.active { border-color: rgba(245,158,11,0.6); background: var(--amber-dim); color: var(--amber); }
.pick-btn.row { flex-direction: row; justify-content: center; padding: 9px; font-size: 13px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; font-size: 14px; color: var(--text-dim); cursor: pointer; }
.checkbox-row input { accent-color: var(--amber); width: 16px; height: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }

svg { display: block; }
.ad-fields-fixed { min-height: 268px; }

/* ---------------- Contrôle technique ---------------- */

.ct-banner {
  display: flex; align-items: center; gap: 14px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 18px; margin-bottom: 20px;
}
.ct-banner .ct-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: #18181b; color: var(--text-dim2); flex-shrink: 0; }
.ct-banner.overdue .ct-icon { background: var(--red-dim); color: var(--red); }
.ct-banner.soon .ct-icon { background: var(--amber-dim); color: var(--amber); }
.ct-banner.ok .ct-icon { background: var(--green-dim); color: var(--green); }
.ct-banner .ct-text { flex: 1; min-width: 0; }
.ct-banner .ct-title { font-size: 13px; color: var(--text-dim2); margin-bottom: 2px; }
.ct-banner .ct-value { font-size: 15px; font-weight: 600; }
.ct-banner a.ct-link { font-size: 13px; color: var(--amber); text-decoration: none; flex-shrink: 0; }
.ct-banner a.ct-link:hover { text-decoration: underline; }

/* ---------------- Parties / pièces multiples (formulaire intervention) --*/

.parts-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.part-row { display: grid; grid-template-columns: 1fr 110px 32px; gap: 8px; align-items: center; }
.part-row input { width: 100%; }
.total-display {
  display: flex; align-items: center; justify-content: space-between; background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin: 4px 0 16px;
  font-size: 14px;
}
.total-display .t-label { color: var(--text-dim2); }
.total-display .t-value { font-family: 'JetBrains Mono', monospace; font-weight: 700; color: var(--amber); font-size: 16px; }
.add-part-btn {
  display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-dim2);
  background: none; border: 1px dashed var(--border-2); border-radius: 8px; padding: 8px 12px; width: 100%; justify-content: center;
  margin-bottom: 16px;
}
.add-part-btn:hover { color: var(--amber); border-color: var(--amber-border); }
.entry-title .parts-sub { font-size: 12px; color: var(--text-dim3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: 'JetBrains Mono', monospace; }

/* ---------------- Documents (admin / mécanique) ---------------- */

.doc-toggle { display: flex; gap: 4px; margin-bottom: 18px; background: #18181b; border-radius: 10px; padding: 4px; width: fit-content; }
.doc-toggle button {
  background: none; border: none; padding: 8px 16px; font-size: 13px; font-weight: 500; border-radius: 8px; color: var(--text-dim3);
}
.doc-toggle button.active { background: var(--amber); color: #09090b; }

.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.folder-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 14px; padding: 16px; text-align: left; position: relative;
}
.folder-card:hover { border-color: var(--border-2); }
.folder-card .f-icon { width: 34px; height: 34px; border-radius: 9px; background: var(--amber-dim); color: var(--amber); display: flex; align-items: center; justify-content: center; }
.folder-card .f-name { font-size: 14px; font-weight: 500; color: var(--text); word-break: break-word; }
.folder-card .f-count { font-size: 12px; color: var(--text-dim3); }
.folder-card .f-del {
  position: absolute; top: 8px; right: 8px; opacity: 0; transition: opacity .15s;
}
.folder-card:hover .f-del { opacity: 1; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
  font-size: 12px; padding: 6px 12px; border-radius: 999px; border: 1px dashed var(--border-2); color: var(--text-dim2); background: none;
}
.chip:hover { border-color: var(--amber-border); color: var(--amber); }

.folder-header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.folder-header h2 { font-family: 'Space Grotesk', sans-serif; font-size: 18px; margin: 0; flex: 1; }

.item-row { display: flex; align-items: center; gap: 14px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.item-row .i-icon { width: 32px; height: 32px; border-radius: 8px; background: #18181b; color: var(--text-dim2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.item-row.file .i-icon { color: var(--amber); }
.item-row.link .i-icon { color: #60a5fa; }
.item-row.video .i-icon { color: #fb7185; }
.item-row .i-info { flex: 1; min-width: 0; }
.item-row .i-title { font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-row .i-sub { font-size: 12px; color: var(--text-dim3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-row .i-actions { display: flex; gap: 2px; flex-shrink: 0; }

.doc-add-row { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
@media (max-width: 480px) {
  .part-row { grid-template-columns: 1fr 90px 28px; }
}

.item-row.note, .item-row.link, .item-row.file, .item-row.video { cursor: pointer; }
.item-row.note:hover, .item-row.link:hover, .item-row.file:hover, .item-row.video:hover { border-color: var(--border-2); }
.item-row.note .i-icon { color: #c084fc; }

/* ---------------- Galerie photo ---------------- */

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-bottom: 8px; }
.photo-thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); cursor: pointer; background: #000; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .15s; }
.photo-thumb:hover img { transform: scale(1.05); }
.photo-del { position: absolute; top: 6px; right: 6px; background: rgba(9,9,11,0.75); opacity: 0; transition: opacity .15s; }
.photo-thumb:hover .photo-del { opacity: 1; }

.lightbox-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.92); z-index: 60; display: none;
  align-items: center; justify-content: center; padding: 24px;
}
.lightbox-img { max-width: 90vw; max-height: 82vh; object-fit: contain; border-radius: 8px; transition: transform .06s ease-out; cursor: zoom-in; }
.lightbox-close { position: absolute; top: 18px; right: 18px; background: rgba(255,255,255,0.08); border: none; color: white; padding: 8px; border-radius: 8px; }
.lightbox-close:hover { background: rgba(255,255,255,0.16); }
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,0.08); border: none;
  color: white; padding: 10px; border-radius: 999px; display: flex;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.16); }
.lightbox-nav.prev { left: 18px; }
.lightbox-nav.next { right: 18px; }
.lightbox-caption { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); color: var(--text-dim2); font-size: 13px; text-align: center; }
@media (max-width: 640px) {
  .lightbox-nav { padding: 8px; }
  .lightbox-nav.prev { left: 6px; }
  .lightbox-nav.next { right: 6px; }
}
