/* assets/style.css */
:root{
  --bg:#e9edf3;
  --bg-deep:#dfe6f1;
  --panel:#f5f7fb;
  --panel-strong:#ffffff;
  --line:#d6dde9;
  --ink:#0f172a;
  --muted:#6b7280;
  --bar:#102a5c;
  --bar-dark:#0b234d;
  --bar-text:#f9fafb;
  --accent:#0aa0ff;
  --accent-dark:#067ad1;
  --accent-red:#c40e0e;
  --ok:#22c55e;
  --warn:#f59e0b;
  --bad:#ef4444;
  --shadow: 0 16px 40px rgba(15,23,42,.14);
  --shadow-soft: 0 8px 24px rgba(15,23,42,.08);
  --radius: 14px;
  --radius-lg: 18px;
  --font: "Noto Sans", "Source Sans 3", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

*{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 620px at 12% -10%, rgba(14,165,233,.15), transparent 55%),
    radial-gradient(1000px 540px at 86% 12%, rgba(196,14,14,.10), transparent 55%),
    linear-gradient(180deg, var(--bg), var(--bg-deep));
  overflow-x:hidden;
}

.bg{
  position: fixed;
  inset:-140px;
  background:
    linear-gradient(125deg, rgba(14,165,233,.08), transparent 35%),
    linear-gradient(125deg, transparent 60%, rgba(6,122,209,.08), transparent 80%),
    linear-gradient(125deg, transparent 72%, rgba(196,14,14,.08), transparent 92%);
  filter: blur(12px);
  transform: rotate(-4deg);
  pointer-events:none;
  z-index:-1;
}

.topbar{
  position: sticky;
  top: 0;
  z-index: 30;
  background:
    linear-gradient(90deg, rgba(16,42,92,.96), rgba(11,35,77,.92)),
    url("m_stripes.svg");
  background-size: cover;
  background-repeat: no-repeat;
  border-bottom: 1px solid rgba(255,255,255,.12);
  color: var(--bar-text);
}

.topbar-inner{
  max-width: 1240px;
  margin: 0 auto;
  padding: 16px 18px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}

.brand{ display:flex; align-items:center; gap:14px; }
.logo{
  width:46px; height:46px;
  border-radius: 14px;
  background: rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.18);
  display:grid;
  place-items:center;
  overflow:hidden;
  position:relative;
}
.logo.slim{
  width:78px; height:68px;
  border-radius: 12px;
  padding: 5px 7px;
}
.logo.slim img{
  width:100%;
  height:100%;
  object-fit:contain;
  transform: scaleY(2);
  transform-origin: center;
}
.logo:before{
  content:"";
  position:absolute; inset:-35px;
  background: linear-gradient(120deg, transparent 0 55%, rgba(255,255,255,.18) 60%, transparent 72%);
  transform: translateX(-35%) rotate(25deg);
  animation: shine 7s linear infinite;
}
@keyframes shine{
  0%{ transform: translateX(-35%) rotate(25deg); opacity:.0}
  20%{opacity:.7}
  50%{opacity:.1}
  100%{ transform: translateX(45%) rotate(25deg); opacity:0}
}

.m{ width:8px; height:30px; display:inline-block; transform: skewX(-18deg); border-radius: 6px; margin:0 2px; }
.m1{ background: #14a2ff; }
.m2{ background: #0b4e92; }
.m3{ background: var(--accent-red); }

.brand-title{ font-weight: 800; letter-spacing: .4px; font-size: 16px; }
.brand-sub{ color: rgba(255,255,255,.78); font-size: 12px; margin-top: 2px; }
.brand-actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.brand-action{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding: 4px 8px;
  border-radius: 999px;
  border:1px solid rgba(255,255,255,.24);
  background: rgba(255,255,255,.08);
  color: var(--bar-text);
  font-size: 12px;
  font-weight: 600;
  text-decoration:none;
}
.brand-action:hover{ background: rgba(255,255,255,.14); }
.brand-action span{ white-space:nowrap; }

.nav{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.navlink{
  color: var(--bar-text);
  text-decoration:none;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 13px;
  opacity: .95;
}
.navlink:hover{
  border-color: rgba(255,255,255,.26);
  background: rgba(255,255,255,.08);
}
.navbtn{
  border-color: rgba(255,255,255,.38);
  background: linear-gradient(90deg, rgba(14,165,233,.2), rgba(6,122,209,.2), rgba(196,14,14,.18));
}

.userpill{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 8px 12px;
  border-radius: 999px;
  border:1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  font-size: 12px;
}
.userpill-controls{
  display:flex;
  align-items:center;
  gap:6px;
}
.lang-btn-mini{
  width:26px;
  height:26px;
  font-size:14px;
  border-radius:8px;
  border:1px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.12);
}
.lang-btn-mini.active{
  border-color: #ffffff;
  box-shadow:0 0 0 2px rgba(255,255,255,.25);
}
.userpill-avatar{
  width:40px;
  height:40px;
  border-radius:50%;
  overflow:hidden;
  border:1px solid var(--line);
  background:#eef2f8;
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
}
.userpill-avatar img{
  width:100%;
  height:100%;
  object-fit:cover;
  object-position:center center;
  display:block;
  border-radius:50%;
}
.userpill-avatar.is-empty{ opacity:.9; }
[data-avatar-upload]{ cursor:pointer; }
.userpill .role{
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  font-size: 10px;
}
.lang-switch{
  display:flex;
  gap:6px;
  align-items:center;
}
.lang-btn{
  width:32px;
  height:32px;
  border-radius:50%;
  border:1px solid rgba(255,255,255,.3);
  background: rgba(255,255,255,.08);
  color: var(--bar-text);
  font-size:18px;
  cursor:pointer;
}
.lang-btn.active{
  border-color: #ffffff;
  box-shadow:0 0 0 2px rgba(255,255,255,.35);
}
.lang-text{ display:none; }
body[data-lang="en"] .lang-text[data-lang="en"],
body[data-lang="el"] .lang-text[data-lang="el"]{
  display:inline;
}

.container{
  max-width: 1240px;
  margin: 0 auto;
  padding: 22px 18px 80px;
}

.hero{
  display:grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 18px;
  align-items:stretch;
}
@media (max-width: 980px){
  .hero{ grid-template-columns: 1fr; }
}
@media (max-width: 720px){
  .brand-action span{ display:none; }
}

.card{
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow:hidden;
  animation: fadeUp .45s ease both;
}

@keyframes fadeUp{
  from{ opacity:0; transform: translateY(12px); }
  to{ opacity:1; transform: translateY(0); }
}

.banner{
  width:100%;
  height: 210px;
  background: #0b1f44;
  position:relative;
}
.banner img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display:block;
}
.banner:after{
  content:"";
  position:absolute; inset:0;
  background:
    radial-gradient(600px 240px at 20% 40%, rgba(14,165,233,.32), transparent 60%),
    radial-gradient(520px 260px at 80% 30%, rgba(196,14,14,.20), transparent 65%),
    linear-gradient(180deg, rgba(0,0,0,.05), rgba(0,0,0,.35));
  pointer-events:none;
}

.hero-body{ padding: 18px 20px 22px; }
.h1{
  font-size: 32px;
  line-height: 1.12;
  margin: 2px 0 8px;
  letter-spacing: .2px;
}
.p{
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.6;
  margin: 0 0 14px;
}
.p strong{ color: var(--ink); }

.kpis{ display:flex; gap: 10px; flex-wrap:wrap; margin-top: 12px; }
.kpi{
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  min-width: 160px;
}
.kpi .label{ color: var(--muted); font-size: 12px; }
.kpi .value{ font-weight: 800; margin-top: 2px; font-size: 14px; }

.side{
  padding: 18px;
  display:flex;
  flex-direction:column;
  gap: 12px;
}
.pill{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 12px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
}
.pill b{ font-size: 14px; }
.pill span{ color: var(--muted); font-size: 12px; }
.pill a{
  text-decoration:none;
  color: var(--ink);
  border:1px solid var(--line);
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--panel-strong);
}
.pill a:hover{ background: #eef2f8; }

.form{ display:grid; gap: 10px; }
.input{
  width:100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--ink);
  outline:none;
  font-size: 14px;
}
.input:focus{
  border-color: rgba(14,165,233,.6);
  box-shadow: 0 0 0 4px rgba(14,165,233,.15);
}
.row{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 520px){
  .row{ grid-template-columns: 1fr; }
}

.pass-meter-row{
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap: wrap;
}
.pass-meter{
  position: relative;
  flex: 1 1 220px;
  height: 10px;
  border-radius: 999px;
  background: #e5eaf3;
  border: 1px solid var(--line);
  overflow: hidden;
}
.pass-meter-bar{
  display:block;
  height:100%;
  width:0%;
  background: #94a3b8;
  transition: width .2s ease, background .2s ease;
}
.pass-meter.weak .pass-meter-bar{ background: #f97316; }
.pass-meter.ok .pass-meter-bar{ background: #f59e0b; }
.pass-meter.strong .pass-meter-bar{ background: #22c55e; }
.pass-meter-label{
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.form-check{
  display:flex;
  align-items:center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.form-check input{
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.btn{
  cursor:pointer;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid rgba(16,42,92,.18);
  background: linear-gradient(90deg, rgba(14,165,233,.22), rgba(6,122,209,.18));
  color: var(--ink);
  font-weight: 800;
  font-size: 13px;
}
.btn:hover{ filter: brightness(1.02); }
.btn.primary{
  background: linear-gradient(90deg, rgba(14,165,233,.28), rgba(6,122,209,.22));
}
.btn.ghost{
  background: var(--panel-strong);
  border-color: var(--line);
  font-weight: 700;
}
.btn.light{
  background: linear-gradient(90deg, rgba(245,247,251,.85), rgba(255,255,255,.9));
  border-color: var(--line);
  font-weight: 700;
}

.alert{
  border:1px solid var(--line);
  background: var(--panel);
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--muted);
}
.alert.ok{ border-color: rgba(34,197,94,.3); color: #166534; background: rgba(34,197,94,.08); }
.alert.bad{ border-color: rgba(239,68,68,.3); color: #991b1b; background: rgba(239,68,68,.08); }

.grid{
  margin-top: 18px;
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 980px){ .grid{ grid-template-columns: 1fr 1fr; } }
@media (max-width: 620px){ .grid{ grid-template-columns: 1fr; } }

.tile{
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
}
.tile h3{ margin:0 0 6px; font-size: 14px; }
.tile p{ margin:0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.collapsible{ padding-top: 10px; }
.collapsible[open]{ padding-bottom: 14px; }
.collapsible > .tile-title{
  list-style: none;
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  font-size: 14px;
  color: #0f172a;
  margin: 0 0 8px;
}
.collapsible > .tile-title::-webkit-details-marker{ display:none; }
.collapsible > .tile-title::after{
  content: "▸";
  font-size: 12px;
  color: var(--muted);
  transition: transform .2s ease;
}
.collapsible[open] > .tile-title::after{ transform: rotate(90deg); }

.appt-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.appt-card{
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}
.appt-card.approved{
  border-color: rgba(16,185,129,.55);
  background: rgba(16,185,129,.08);
}
.appt-card .appt-title{
  font-weight: 700;
  margin-bottom: 4px;
}
.appt-card .appt-meta{
  color: var(--muted);
  font-size: 12px;
}

.footer{
  max-width: 1240px;
  margin: 0 auto 20px;
  padding: 14px 18px;
  display:flex;
  justify-content:space-between;
  gap:10px;
  color: rgba(30,41,59,.65);
  font-size: 12px;
  border-top: 1px solid rgba(15,23,42,.08);
}
.footer .footlink{ color: rgba(15,23,42,.78); text-decoration:none; }
.footer .footlink:hover{ text-decoration:underline; }
.dot{ opacity:.5; padding:0 4px; }

/* Dashboard CRM layout */
.crm-header{
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.crm-header:before{
  content:"";
  position:absolute;
  inset:0;
  background: url("m_stripes.svg") no-repeat center;
  background-size: cover;
  opacity: .08;
  filter: grayscale(.3) saturate(.7);
  pointer-events:none;
}
.crm-title{ font-size: 26px; font-weight: 800; margin: 2px 0 6px; }
.crm-sub{ color: var(--muted); font-size: 13px; }
.crm-headline{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 16px;
  flex-wrap:wrap;
}
.crm-headline .eyebrow{
  text-transform: uppercase;
  letter-spacing: .5px;
  font-size: 11px;
  color: var(--accent-dark);
  font-weight: 800;
}
.crm-user{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap: 6px;
  text-align:right;
}
.crm-user .badge{
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(14,165,233,.15);
  color: #0b4e92;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.crm-kpis{ display:flex; gap: 10px; flex-wrap:wrap; margin-top: 14px; }
.kpi-user{
  display:flex;
  align-items:center;
  gap: 12px;
  padding: 12px 14px;
  min-width: 260px;
  cursor: pointer;
}
.kpi-user .badge{
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(14,165,233,.15);
  color: #0b4e92;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.kpi-user .user-lines{
  display:flex;
  flex-direction:column;
  gap: 2px;
}
.kpi-user .user-small{ font-size: 12px; color: var(--muted); }
.kpi-avatar{
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #eef2f8;
  flex: 0 0 40px;
  display:flex;
  align-items:center;
  justify-content:center;
}
.kpi-avatar img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display:block;
  border-radius: 50%;
}
.kpi-avatar-fallback{
  font-size: 16px;
  font-weight: 800;
  color: #0f274d;
}

.userpill{
  display:flex;
  align-items:center;
  gap: 10px;
  position: relative;
}
.userpill-btn{
  display:flex;
  align-items:center;
  gap: 8px;
  background: transparent;
  border: 1px solid rgba(15,39,77,.25);
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  color: #0f274d;
}
.userpill-caret{ font-size: 12px; color: #0f274d; }
.userpill-lock{
  display:flex;
  align-items:center;
  justify-content:center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(15,39,77,.25);
  background: transparent;
  text-decoration:none;
  color: #0f274d;
}
.userpill .user-meta span{ color: #0f274d; }
.userpill .user-meta .role{ color: #334155; }

.topbar .userpill-btn{
  border-color: rgba(255,255,255,.28);
  color: #f8fafc;
}
.topbar .userpill .user-meta span{ color: #f8fafc; }
.topbar .userpill .user-meta .role{ color: #cbd5f5; }
.topbar .userpill-caret{ color: #f8fafc; }
.topbar .userpill-lock{ border-color: rgba(255,255,255,.28); color: #f8fafc; }
.user-menu{
  position: absolute;
  top: 42px;
  right: 0;
  width: 260px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  padding: 10px;
  z-index: 2000;
}
.user-menu, .user-menu *{
  color: #0f274d;
}
.user-menu-head{
  display:flex;
  align-items:center;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.user-menu-avatar{
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:center;
  background: #eef2f8;
}
.user-menu-avatar img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display:block;
  border-radius: 50%;
}
.user-menu-fallback{
  font-weight: 800;
  color: #0f274d;
}
.user-menu-name{ font-weight: 800; color: #0f274d; }
.user-menu-email{ font-size: 12px; color: #475569; }
.user-menu-actions{
  display:flex;
  flex-direction:column;
  gap: 6px;
  padding-top: 8px;
}
.user-menu-link{
  text-decoration:none;
  color: #0f274d;
  font-weight: 700;
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 8px;
}
.user-menu-link:hover{ background: #eef6ff; }
.avatar-btn{
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(148,163,184,.4);
  background: #fff;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
}
.avatar-img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display:block;
}
.avatar-fallback{
  display:flex;
  align-items:center;
  justify-content:center;
  width: 100%;
  height: 100%;
  font-size: 16px;
}
.userpill .user-meta{
  display:flex;
  flex-direction:column;
  line-height: 1.2;
}

.toolbar{
  margin-top: 14px;
  padding: 12px 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  flex-wrap:wrap;
}
.toolbar-group{ display:flex; gap: 8px; flex-wrap:wrap; }

.searchbar{
  margin-top: 12px;
  padding: 12px 14px;
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap:wrap;
}
.searchbar label{ font-weight: 700; font-size: 13px; color: var(--muted); }
.searchbar .input{ max-width: 360px; }

.crm-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}
@media (max-width: 1100px){
  .crm-grid{ grid-template-columns: 1fr; }
}

.panel{
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  overflow:hidden;
}
.panel-head{
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-weight: 800;
  background: linear-gradient(90deg, rgba(15,23,42,.02), rgba(14,165,233,.06));
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 8px;
}
.panel-body{ padding: 12px 14px; }

.table{
  width:100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}
.table-scroll{
  width: 100%;
  overflow-x: visible;
}
.table-scroll .table{
  min-width: 0;
}
.table th, .table td{
  padding: 12px 12px;
  border-bottom: 1px solid var(--line);
  text-align:left;
  word-break: break-word;
  white-space: normal;
}
.table th{ color: #0f274d; background: #eef2f8; font-weight: 800; }
.table tr:nth-child(even) td{ background: #fafbfe; }
.table tr:hover td{ background: #eef6ff; }
.table .muted{ color: var(--muted); }
.table tr.active td{ background: #e0f2ff; }
.rowlink{ color: inherit; text-decoration:none; font-weight: 700; }
.rowlink:hover{ text-decoration: underline; }
.task-photos{
  margin-top: 10px;
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.task-photos img{
  width:100%;
  height:120px;
  object-fit:cover;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.progress{
  height: 8px;
  border-radius: 999px;
  background: rgba(15,23,42,.08);
  overflow: hidden;
  margin-bottom: 6px;
}
.progress span{
  display:block;
  height:100%;
  background: linear-gradient(90deg, #0aa0ff, #22c55e);
}

.toast{
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #0f172a;
  color: #f9fafb;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15,23,42,.35);
  font-size: 13px;
  z-index: 999;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show{
  opacity: 1;
  transform: translateY(0);
}
.row-red td{ background:#fee2e2; }
.row-yellow td{ background:#fef9c3; }
.row-green td{ background:#dcfce7; }

.empty{
  padding: 18px 14px;
  color: var(--muted);
  font-size: 13px;
}

.tabs{
  display:flex;
  gap: 6px;
  flex-wrap:wrap;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px 0;
  background: #f3f6fb;
}
.tab{
  border:none;
  background: transparent;
  padding: 8px 10px;
  border-radius: 10px 10px 0 0;
  font-weight: 700;
  font-size: 12px;
  color: var(--muted);
  cursor:pointer;
}
.tab.active{
  color: #0f274d;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-bottom: 1px solid var(--panel-strong);
}

.tab-panel{ display:none; }
.tab-panel.active{ display:block; }

.panel-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 720px){
  .panel-grid{ grid-template-columns: 1fr; }
}

.badge-row{ display:flex; align-items:center; gap: 8px; flex-wrap:wrap; }
.badge{
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #1e3a8a;
  font-size: 11px;
  font-weight: 700;
}
.badge.danger{
  background: #fee2e2;
  color: #b91c1c;
}
.tree-list{
  display:flex;
  flex-direction:column;
  gap: 10px;
}
.tree-node{
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  padding: 10px 12px;
}
.tree-title{
  font-weight: 700;
  display:flex;
  gap: 8px;
  flex-wrap:wrap;
  align-items:center;
}
.tree-thumb{
  width: 36px;
  height: 28px;
  border-radius: 8px;
  overflow:hidden;
  background: #eef2ff;
  display:flex;
  align-items:center;
  justify-content:center;
  border: 1px solid rgba(15,23,42,.08);
  flex: 0 0 auto;
}
.tree-thumb-btn{
  border: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  cursor: zoom-in;
}
.tree-thumb img{
  width:100%;
  height:100%;
  object-fit: cover;
  display:block;
}
.tree-thumb-fallback{
  font-size: 16px;
  opacity: .7;
}
.tree-plate{ font-weight: 700; }
.tree-children{
  margin-top: 8px;
  padding-left: 16px;
  display:flex;
  flex-direction:column;
  gap: 6px;
}
.tree-leaf{
  font-size: 12px;
  color: #0f172a;
}
.tree-leaf.muted{ color: var(--muted); }

.statusbar{
  margin-top: 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.auth-card{ max-width: 560px; margin: 24px auto; }
.auth-card .hero-body{ padding: 20px; }

@media (max-width: 700px){
  .topbar-inner{ flex-direction:column; align-items:flex-start; }
  .userpill{ width:100%; justify-content:space-between; }
  .searchbar .input{ max-width: 100%; width: 100%; }
}

.photo-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.photo-card{
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-strong);
  overflow:hidden;
  box-shadow: var(--shadow-soft);
}
.photo-card img{
  width:100%;
  height:auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display:block;
  cursor: pointer;
}
.profile-photo-card{
  padding: 10px 10px 6px;
}
.profile-photo-round{
  width: 140px;
  height: 140px;
  border-radius: 50%;
  overflow: hidden;
  margin: 6px auto 4px;
  border: 1px solid var(--line);
  background: #fff;
}
.profile-photo-round img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}
.photo-meta{
  padding: 8px 10px;
  font-size: 12px;
  color: var(--muted);
}

.pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
}
.pill.ok{
  background: rgba(34,197,94,.16);
  color: #166534;
  border: 1px solid rgba(34,197,94,.35);
}
.pill.requested{
  background: rgba(234,179,8,.18);
  color: #92400e;
  border: 1px solid rgba(234,179,8,.45);
}
.pill.approved{
  background: rgba(34,197,94,.18);
  color: #166534;
  border: 1px solid rgba(34,197,94,.45);
}
.pill.declined{
  background: rgba(239,68,68,.16);
  color: #991b1b;
  border: 1px solid rgba(239,68,68,.5);
}
.pill.ordered{
  background: rgba(124,58,237,.18);
  color: #4c1d95;
  border: 1px solid rgba(124,58,237,.45);
}
.pill.received{
  background: rgba(249,115,22,.18);
  color: #9a3412;
  border: 1px solid rgba(249,115,22,.45);
}
.pill.installed{
  background: rgba(59,130,246,.18);
  color: #1e3a8a;
  border: 1px solid rgba(34,197,94,.6);
}
.pill.cancelled{
  background: rgba(239,68,68,.16);
  color: #991b1b;
  border: 1px solid rgba(249,115,22,.6);
}
.pill.warn{
  background: rgba(234,179,8,.16);
  color: #92400e;
  border: 1px solid rgba(234,179,8,.35);
}
.pill.danger{
  background: rgba(239,68,68,.14);
  color: #991b1b;
  border: 1px solid rgba(239,68,68,.35);
}
.pill.neutral{
  background: rgba(148,163,184,.18);
  color: #334155;
  border: 1px solid rgba(148,163,184,.35);
}

.veh-thumb{
  width: 64px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  display: inline-block;
  cursor: zoom-in;
}

.photo-modal{
  position: fixed;
  inset: 0;
  background: rgba(12, 18, 28, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  padding: 24px;
}
.photo-modal.hidden{ display:none; }
.hidden{ display:none; }
.photo-modal-inner{
  background: #0f172a;
  border-radius: 16px;
  border: 1px solid rgba(148,163,184,.25);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.45);
  max-width: min(960px, 92vw);
  max-height: 86vh;
  padding: 16px;
  position: relative;
}
.photo-modal img{
  display:block;
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 12px;
  background: #0b1020;
}
.photo-modal-caption{
  margin-top: 10px;
  color: #e5e7eb;
  font-size: 12px;
  text-align: center;
}
.photo-modal-close{
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.35);
  background: rgba(15,23,42,.75);
  color: #e5e7eb;
  font-weight: 700;
  cursor: pointer;
}
.chat-modal{
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3100;
  padding: 20px;
}
.chat-modal.hidden{ display:none; }
.chat-card{
  width: min(520px, 92vw);
  background: #0f172a;
  border-radius: 16px;
  border: 1px solid rgba(148,163,184,.25);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.45);
  padding: 16px;
  color: #e5e7eb;
  position: relative;
}
.contact-modal{
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3100;
  padding: 20px;
}
.contact-modal.hidden{ display:none; }
.contact-card{
  width: min(520px, 92vw);
  background: #0f172a;
  border-radius: 16px;
  border: 1px solid rgba(148,163,184,.25);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.45);
  padding: 16px;
  color: #e5e7eb;
  position: relative;
}
.contact-card .input{
  background: #111827;
  color: #e5e7eb;
  border-color: rgba(148,163,184,.35);
}
.chat-close{
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.35);
  background: rgba(15,23,42,.75);
  color: #e5e7eb;
  font-weight: 700;
  cursor: pointer;
}
.chat-head{ margin-bottom: 10px; }
.chat-title{ font-size: 16px; font-weight: 800; }
.chat-sub{ font-size: 12px; color: rgba(226,232,240,.8); }
.chat-log{
  background: rgba(15,23,42,.35);
  border: 1px solid rgba(148,163,184,.2);
  border-radius: 12px;
  padding: 10px;
  max-height: 320px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-msg{
  background: rgba(255,255,255,.08);
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.4;
}
.chat-msg.me{
  align-self: flex-end;
  background: rgba(14,165,233,.18);
}
.chat-msg .meta{
  font-size: 10px;
  opacity: .75;
  margin-bottom: 4px;
}
.chat-input{
  display:flex;
  gap:8px;
  margin-top: 10px;
}
.chat-input .input{
  flex:1;
  background: #111827;
  color: #e5e7eb;
  border-color: rgba(148,163,184,.35);
}
.panel-actions{
  display:flex;
  justify-content:flex-end;
  margin-bottom: 10px;
}
.mini-cal-wrap{
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: var(--panel-strong);
  margin-bottom: 10px;
}
.mini-cal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom: 8px;
}
.mini-cal-title{
  font-weight: 700;
  color: var(--ink-strong);
}
.mini-cal-head{
  gap: 10px;
}
.mini-cal-grid{
  margin-top: 2px;
}
.mini-cal-dow{
  display:grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  align-items: center;
}
.mini-cal-dow-cell{
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 6px 0;
  border: 1px solid transparent;
  border-radius: 10px;
  letter-spacing: 0.02em;
}
.mini-appt-list .mini-appt-card.active{
  border-color: #1d4ed8;
  box-shadow: 0 0 0 2px rgba(29,78,216,0.15);
}
.mini-appt-detail{
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #f8fafc;
  margin-top: 8px;
}
.mini-cal-grid{
  display:grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.mini-cal-day{
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px;
  min-height: 54px;
  background: #f8fafc;
  position: relative;
  cursor: pointer;
}
.mini-cal-day.disabled{
  opacity: 0.45;
  background: #f8fafc;
  border-color: #e5e7eb;
  cursor: default;
}
.mini-cal-day .mini-cal-date{
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
}
.mini-cal-day .mini-cal-count{
  position:absolute;
  right: 6px;
  bottom: 6px;
  font-size: 11px;
  color: #475569;
}
.mini-cal-day.pending{
  background: #fff7ed;
  border-color: #fb923c;
}
.mini-cal-day.approved{
  background: #eff6ff;
  border-color: #60a5fa;
}
.mini-cal-day.selected{
  border-color: #1d4ed8;
  box-shadow: 0 0 0 2px rgba(29,78,216,0.15);
}
.mini-cal-tooltip{
  position: absolute;
  z-index: 3205;
  background: #0f172a;
  color: #f8fafc;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  max-width: 260px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
  display:none;
}
.mini-appt-list .mini-appt-card{
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  margin-bottom: 10px;
}
.mini-appt-card .meta{
  color: #475569;
  font-size: 12px;
  margin-top: 4px;
}
.mini-appt-card .mini-actions{
  display:flex;
  gap:8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.mini-appt-actions{
  margin-top: 6px;
}
.modal{
  position: fixed;
  inset: 0;
  background: rgba(12, 18, 28, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3200;
  padding: 20px;
}
.modal.hidden{ display:none; }
.modal-inner{
  background: var(--panel-strong);
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
  max-width: 680px;
  width: min(680px, 92vw);
  padding: 18px;
  position: relative;
}
.modal-inner .input,
.modal-inner select,
.modal-inner input[type="date"]{
  width: 100%;
  box-sizing: border-box;
}
@media (max-width: 520px){
  .modal{
    padding: 12px;
  }
  .modal-inner{
    width: 100%;
    max-width: 100%;
    padding: 14px;
  }
  .appt-row{
    gap: 10px;
  }
  .appt-row > div{
    min-width: 100%;
    width: 100%;
  }
  .appt-row .input{
    width: 100%;
  }
  .appt-slots{
    gap: 6px;
  }
  .appt-slot{
    flex: 1 1 46%;
    text-align: center;
  }
  .table-scroll{
    overflow-x: hidden;
  }
.table.responsive{
    display: block;
  }
  .table.responsive thead{
    display: none;
  }
  .table.responsive tbody{
    display: block;
  }
  .table.responsive tr{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    padding: 10px 6px;
    border-bottom: 1px solid var(--line);
  }
  .table.responsive td{
    display: block;
    padding: 0;
    white-space: normal;
    word-break: break-word;
  }
  .table.responsive td:last-child{
    grid-column: 1 / -1;
    margin-top: 6px;
  }
  .table.responsive td .btn{
    width: 100%;
  }
  .table.responsive td:before{
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 2px;
    content: attr(data-label);
  }
}

@media (min-width: 900px){
  .table.cardish{
    border-collapse: separate;
    border-spacing: 0 14px;
  }
  .table.cardish thead{
    display: none;
  }
  .table.cardish tbody{
    display: block;
  }
  .table.cardish tr{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 16px;
    padding: 14px 16px;
    background: #f3f6fb;
    border: 1px solid var(--line);
    border-radius: 14px;
    margin-bottom: 6px;
  }
  .table.cardish tr:nth-child(even){
    background: #eef3fb;
    border-color: #d7e2f3;
  }
  .table.cardish tr:nth-child(even) td{
    background: transparent;
  }
  .table.cardish td{
    display: block;
    padding: 0;
    white-space: normal;
    word-break: break-word;
    background: transparent;
    border-bottom: 0;
  }
  .table.cardish tr:hover td{
    background: transparent;
  }
  .table.cardish td:last-child{
    grid-column: 1 / -1;
    margin-top: 6px;
  }
  .table.cardish td .btn{
    width: 100%;
  }
  .table.cardish td:before{
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 2px;
    content: attr(data-label);
  }
}
.modal-close{
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.35);
  background: #fff;
  color: #0f172a;
  font-weight: 700;
  cursor: pointer;
}
.avatar-crop-inner{
  max-width: min(680px, 92vw);
}
.avatar-crop-wrap{
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 8px 0 12px;
}
.avatar-crop-box{
  width: 320px;
  height: 320px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(148,163,184,.35);
  background: #0b1020;
  position: relative;
  cursor: grab;
}
.avatar-crop-box:active{ cursor: grabbing; }
.avatar-crop-box img{
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
  user-select: none;
  -webkit-user-drag: none;
}
.avatar-crop-controls{
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap:wrap;
  justify-content:center;
}
@media (max-width: 520px){
  .avatar-crop-box{ width: 240px; height: 240px; }
}

.appt-request{
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.fault-request .fault-mileage{
  display:flex;
  gap: 8px;
  align-items:center;
}
.fault-request textarea.input{
  min-height: 78px;
  resize: vertical;
}
.fault-toggle{
  display:flex;
  align-items:center;
  gap: 8px;
  margin: 6px 0 4px;
}
.fault-appt{
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}
.appt-row{
  display:flex;
  gap: 10px;
  flex-wrap:wrap;
  align-items:flex-end;
}
.appt-row > div{ flex:1; min-width: 160px; }
.appt-slots{
  margin: 10px 0;
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
}
.appt-slot{
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  font-size: 12px;
  font-weight: 700;
  cursor:pointer;
}
.appt-slot.unavailable{
  background: #111827;
  color: #e5e7eb;
  border-color: #111827;
  cursor:not-allowed;
  opacity: .65;
}
.appt-slot.selected{
  background: rgba(14,165,233,.18);
  border-color: rgba(14,165,233,.45);
  color: #0b4e92;
}
.table tr[data-appt-open]{
  cursor: pointer;
}
.table tr[data-appt-open]:hover{
  background: #eef6ff;
}

.severity-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}
.severity-pill.sev-low {
  color: #4d7c0f;
  background: #ecfccb;
  border-color: #bef264;
}
.severity-pill.sev-medium {
  color: #c2410c;
  background: #ffedd5;
  border-color: #fdba74;
}
.severity-pill.sev-high {
  color: #b91c1c;
  background: #fee2e2;
  border-color: #fca5a5;
}

.parts-group {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  background: #f8fafc;
  margin-bottom: 12px;
}
.parts-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.parts-group-title {
  font-weight: 700;
  color: #0f172a;
}
.parts-group-sub {
  font-size: 12px;
  color: var(--muted);
}
.parts-group-right {
  text-align: right;
}
.parts-group-total {
  font-size: 12px;
  color: #1f2937;
  margin-bottom: 4px;
}
.parts-group-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.parts-group-compact-list {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}
.parts-group-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #ffffff;
  cursor: pointer;
}
.parts-group-compact:hover {
  background: #eef6ff;
}
.part-thumb-wrap {
  margin-bottom: 6px;
}
.part-thumb {
  width: 54px;
  height: 40px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  display: block;
}
.parts-group-compact-title {
  font-weight: 600;
  color: #0f172a;
}
.parts-group-compact-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}
.parts-group-compact-meta .sum {
  font-weight: 600;
  color: #0f172a;
}
