:root{
  /* Pearl/iCloud Design Tokens */
  --bg: #eef2f7;
  --bg-pearl: #eef2f7;
  --bg-pearl-deep: #e4e9f0;
  --paper: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --line: #e6edf5;

  /* Glass & Depth */
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-blur: blur(15px);
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow2: 0 16px 40px rgba(15, 23, 42, 0.10);
  --pearl-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --pearl-border: 1px solid rgba(255, 255, 255, 0.7);
  --radius: 16px;

  /* Accent Colors */
  --primary: #0ea5e9;
  --primary2:#1d4ed8;
  --primary-glow: #4facfe;
  --primary-secondary: #00f2fe;
  --success: #16a34a;
  --danger: #dc2626;

  /* Typography */
  --font-main: Tahoma, "SF Pro", "Inter", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: var(--font-main);
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(79, 172, 254, 0.14), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(0, 242, 254, 0.10), transparent 50%),
    var(--bg-pearl);
  color: var(--text);
}

a{color:inherit; text-decoration:none}
code{font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;}
.container{max-width:1100px; margin:0 auto; padding:0 18px}

/* Top bar (public site) */
.topbar{
  position: sticky; top: 0; z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(10px);
}
.topbar-inner{
  display:flex; align-items:center; justify-content:space-between;
  gap:14px; padding:8px 0;
  min-height: 140px;
}

.brand{display:flex; align-items:center}
.brand-logo{
  height:140px;
  width:auto;
  display:block;
}


.nav{display:flex; align-items:center; gap:10px; flex-wrap:wrap}
.nav-link{
  padding:9px 12px;
  border:1px solid transparent;
  border-radius:12px;
  color: var(--muted);
}
.nav-link:hover{
  border-color: var(--line);
  background: rgba(15,23,42,.03);
  color: var(--text);
}

/* Buttons — speed bump convex (blue bevel) */
.btn{
  display:inline-flex; align-items:center; justify-content:center;
  padding:10px 14px;
  border-radius: 14px;
  border:1px solid rgba(14,165,233,.30);
  background: linear-gradient(180deg, rgba(230,245,255,.95), rgba(200,230,250,.85));
  color: var(--text);
  font-weight: 500;
  box-shadow:
    0 3px 6px rgba(15,23,42,.08),
    0 1px 2px rgba(15,23,42,.05),
    inset 0 2px 0 rgba(255,255,255,1),
    inset 0 -1px 0 rgba(15,23,42,.05);
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn:hover{
  transform: translateY(-1px);
  box-shadow:
    0 4px 10px rgba(15,23,42,.12),
    0 2px 4px rgba(15,23,42,.06),
    inset 0 2px 0 rgba(255,255,255,1),
    inset 0 -1px 0 rgba(15,23,42,.06);
}
.btn:active{transform: translateY(0)}

.btn-primary{
  border-color: rgba(14,165,233,.30);
  background: linear-gradient(180deg, rgba(230,245,255,.95), rgba(200,230,250,.85));
}
.btn-outline{
  background: linear-gradient(180deg, rgba(230,245,255,.95), rgba(200,230,250,.85));
  border-color: rgba(14,165,233,.30);
  color: var(--text);
}

.main{padding:34px 0 54px}

/* Alerts — speed bump convex */
.alert{
  border:1px solid rgba(200,210,225,.3);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(235,240,248,.85));
  box-shadow:
    0 3px 6px rgba(15,23,42,.08),
    inset 0 2px 0 rgba(255,255,255,1),
    inset 0 -1px 0 rgba(15,23,42,.04);
}
.alert ul{margin: 8px 0 0; padding-left: 18px}
.alert-success{border-color: rgba(22,163,74,.25)}
.alert-danger{border-color: rgba(220,38,38,.25)}

/* Public hero */
.hero{
  display:grid;
  grid-template-columns: 1.25fr .85fr;
  gap: 18px;
  align-items: start;
}
.badge{
  display:inline-flex; align-items:center;
  padding:7px 12px;
  border-radius:999px;
  border: 1px solid rgba(22,163,74,.25);
  background: rgba(22,163,74,.08);
  color: #0b3d1a;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 12px;
}
h1{
  margin:0 0 10px;
  font-size: 36px;
  letter-spacing: -0.6px;
  line-height: 1.12;
}
.lead{
  margin:0 0 16px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
  max-width: 72ch;
}
.actions{display:flex; gap:10px; flex-wrap:wrap; margin: 14px 0 18px}

/* Public mini cards — speed bump convex */
.mini{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.mini-item{
  border:1px solid rgba(200,210,225,.3);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(235,240,248,.85));
  padding: 12px;
  box-shadow:
    0 3px 6px rgba(15,23,42,.08),
    inset 0 2px 0 rgba(255,255,255,1),
    inset 0 -1px 0 rgba(15,23,42,.04);
}
.mini-title{font-weight:800; margin-bottom:4px}
.mini-text{color: var(--muted); font-size: 13px; line-height: 1.4}

/* Cards — speed bump convex */
.card, .panel-card, .stat-card{
  border:1px solid rgba(200,210,225,.3);
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(238,242,247,.88));
  border-radius: calc(var(--radius) + 6px);
  box-shadow:
    0 4px 10px rgba(15,23,42,.08),
    0 1px 3px rgba(15,23,42,.05),
    inset 0 2px 0 rgba(255,255,255,1),
    inset 0 -1px 0 rgba(15,23,42,.04);
  transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover, .panel-card:hover, .stat-card:hover{
  transform: translateY(-1px);
  box-shadow:
    0 6px 16px rgba(15,23,42,.12),
    0 2px 4px rgba(15,23,42,.06),
    inset 0 2px 0 rgba(255,255,255,1),
    inset 0 -1px 0 rgba(15,23,42,.05);
}
.card{padding: 18px}
.card-title{font-weight:900; margin-bottom: 10px}
.card-row{display:flex; gap:10px; padding:10px 0; border-top:1px solid var(--line)}
.card-row:first-of-type{border-top:none}
.dot{
  width:10px; height:10px; border-radius:50%;
  margin-top: 6px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  box-shadow: 0 10px 20px rgba(14,165,233,.22);
}
.row-title{font-weight:900}
.row-text{color: var(--muted); font-size: 13px; margin-top:2px}

/* Footer (public) */
.footer{
  border-top:1px solid var(--line);
  background: rgba(255,255,255,.75);
}
.footer-inner{
  display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap;
  padding: 18px 0;
}
.muted{color: var(--muted); font-size: 13px}
.small{font-size: 12px}

/* ---------------------------
   DASHBOARD SHELL
---------------------------- */
.dash-body{
  background: var(--bg);
}

.dash-shell{
  min-height: 100vh;
  display:grid;
  grid-template-columns: 280px 1fr;
}

/* Sidebar */
.sidebar{
  position: sticky;
  top: 0;
  height: 100vh;
  border-right:1px solid var(--line);
  background: #ffffff;
  box-shadow: 12px 0 30px rgba(15,23,42,.03);
  display:flex;
  flex-direction: column;
  z-index: 20;
}
.sidebar-top{
  padding: 18px 16px 14px;
  border-bottom:1px solid var(--line);
}
.sidebar-logo{
  /* Logo: +50% (72px -> 108px) */
  height:108px;
  width:auto;
  display:block;
}

.sidebar-nav{
  padding: 10px;
  display:flex;
  flex-direction: column;
  gap: 6px;
}
.side-link{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  color: var(--muted);
  border:1px solid transparent;
}
.side-link:hover{
  background: linear-gradient(180deg, rgba(255,255,255,.90), rgba(235,240,248,.80));
  border-color: rgba(200,210,225,.3);
  color: var(--text);
  box-shadow:
    0 2px 4px rgba(15,23,42,.05),
    inset 0 1px 0 rgba(255,255,255,.9),
    inset 0 -1px 0 rgba(15,23,42,.03);
}
.side-link.is-active{
  background: linear-gradient(180deg, rgba(230,245,255,.92), rgba(200,230,250,.82));
  border-color: rgba(14,165,233,.20);
  color: var(--text);
  box-shadow:
    0 2px 4px rgba(14,165,233,.08),
    inset 0 2px 0 rgba(255,255,255,.9),
    inset 0 -1px 0 rgba(14,165,233,.06);
}
/* Sidebar icons: +30% */
.ico{width: 29px; text-align:center; font-size: 1.3em;}
.chip{
  margin-left:auto;
  font-size: 11px;
  padding: 5px 12px;
  border-radius: 999px;
  border:1px solid rgba(200,210,225,.3);
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(235,240,248,.85));
  color: var(--text);
  font-weight: 600;
  box-shadow:
    0 2px 4px rgba(15,23,42,.06),
    inset 0 1px 0 rgba(255,255,255,1),
    inset 0 -1px 0 rgba(15,23,42,.03);
  transition: transform .12s ease, box-shadow .12s ease;
}
.chip:hover{
  transform: translateY(-1px);
  box-shadow:
    0 3px 6px rgba(15,23,42,.10),
    inset 0 2px 0 rgba(255,255,255,1),
    inset 0 -1px 0 rgba(15,23,42,.05);
}
.chip.is-active{
  border-color: rgba(200,210,225,.45);
  background: linear-gradient(180deg, rgba(240,243,248,.95), rgba(225,230,238,.88));
  box-shadow:
    0 3px 8px rgba(15,23,42,.10),
    inset 0 2px 0 rgba(255,255,255,1),
    inset 0 -1px 0 rgba(15,23,42,.05);
}
.side-divider{
  height:1px;
  background: var(--line);
  margin: 6px 8px;
}
.sidebar-bottom{
  margin-top:auto;
  padding: 12px 16px 16px;
  border-top:1px solid var(--line);
}

/* Topbar (dashboard) */
.dash-main{
  display:flex;
  flex-direction: column;
  min-width: 0;
}
.dash-topbar{
  position: sticky;
  top: 0;
  z-index: 10;
  display:flex;
  justify-content: space-between;
  gap: 12px;
  align-items:center;
  padding: 14px 18px;
  border-bottom:1px solid var(--line);
  background: rgba(247,249,252,.85);
  backdrop-filter: blur(10px);
}
.dash-topbar-left{display:flex; align-items:center; gap: 12px; min-width: 0}
.page-title{min-width:0}
.kicker{font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .08em}
.title{font-size: 16px; font-weight: 900; white-space: nowrap; overflow:hidden; text-overflow: ellipsis}

.dash-topbar-right{display:flex; align-items:center; gap:10px; flex-wrap:wrap; justify-content:flex-end}
.search-wrap{min-width: 220px; max-width: 360px; flex: 1}
.search{
  width:100%;
  border:1px solid rgba(200,210,225,.3);
  border-radius: 14px;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(235,240,248,.85));
  outline: none;
  box-shadow:
    0 2px 4px rgba(15,23,42,.06),
    inset 0 2px 0 rgba(255,255,255,1),
    inset 0 -1px 0 rgba(15,23,42,.04);
  transition: box-shadow .15s ease;
}
.search:focus{border-color: rgba(14,165,233,.35); box-shadow: 0 0 0 4px rgba(14,165,233,.12)}

/* Pill buttons — speed bump convex */
.pill-btn{
  display:inline-flex; align-items:center; justify-content:center;
  padding: 9px 12px;
  border-radius: 999px;
  border:1px solid rgba(14,165,233,.30);
  background: linear-gradient(180deg, rgba(230,245,255,.95), rgba(200,230,250,.85));
  font-weight: 500;
  color: var(--text);
  box-shadow:
    0 3px 6px rgba(15,23,42,.08),
    inset 0 2px 0 rgba(255,255,255,1),
    inset 0 -1px 0 rgba(15,23,42,.05);
  transition: transform .15s ease, box-shadow .15s ease;
}
.pill-btn:hover{
  transform: translateY(-1px);
  box-shadow:
    0 4px 10px rgba(15,23,42,.12),
    inset 0 2px 0 rgba(255,255,255,1),
    inset 0 -1px 0 rgba(15,23,42,.06);
}

/* Icon button — speed bump convex */
.icon-btn{
  width:40px; height:40px;
  border-radius: 14px;
  border:1px solid rgba(14,165,233,.30);
  background: linear-gradient(180deg, rgba(230,245,255,.95), rgba(200,230,250,.85));
  font-size: 18px;
  cursor:pointer;
  box-shadow:
    0 3px 6px rgba(15,23,42,.08),
    inset 0 2px 0 rgba(255,255,255,1),
    inset 0 -1px 0 rgba(15,23,42,.05);
  transition: transform .15s ease, box-shadow .15s ease;
}
.icon-btn:hover{
  transform: translateY(-1px);
  box-shadow:
    0 4px 10px rgba(15,23,42,.12),
    inset 0 2px 0 rgba(255,255,255,1),
    inset 0 -1px 0 rgba(15,23,42,.06);
}

/* Content */
.dash-content{
  padding: 18px;
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
}
.dash-footer{
  padding: 14px 18px;
  border-top:1px solid var(--line);
  background: rgba(255,255,255,.70);
  display:flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap:wrap;
}

/* Dashboard grid */
.dash-grid{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  align-items: start;
}
.span-2{grid-column: span 2}

.stat-card{
  padding: 16px;
  border-radius: var(--radius);
}
.stat-top{display:flex; align-items:center; justify-content: space-between}
.stat-label{color: var(--muted); font-weight: 800; font-size: 13px}
.stat-ico{font-size: 18px}
.stat-value{font-size: 34px; font-weight: 1000; margin-top: 8px}
.stat-sub{color: var(--muted); font-size: 13px; margin-top: 2px}

.panel-card{
  padding: 16px;
  border-radius: var(--radius);
}
.panel-head{
  display:flex;
  justify-content: space-between;
  gap: 12px;
  align-items:flex-start;
  margin-bottom: 10px;
}
.panel-title{font-weight: 1000}
.panel-sub{color: var(--muted); font-size: 13px; margin-top: 2px}

/* Accordion activity log — speed bump convex */
.accordion{border-top: none}
.acc-item{
  border-bottom: none;
  margin-bottom: 4px;
}
.acc-btn{
  width:100%;
  text-align:left;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(235,240,248,.85));
  border: 1px solid rgba(200,210,225,.3);
  cursor: pointer;
  box-shadow:
    0 2px 4px rgba(15,23,42,.06),
    inset 0 2px 0 rgba(255,255,255,1),
    inset 0 -1px 0 rgba(15,23,42,.04);
  transition: transform .15s ease, box-shadow .15s ease;
}
.acc-btn:hover{
  transform: translateY(-1px);
  box-shadow:
    0 3px 6px rgba(15,23,42,.10),
    inset 0 2px 0 rgba(255,255,255,1),
    inset 0 -1px 0 rgba(15,23,42,.06);
}
.acc-left{display:flex; align-items:center; gap: 10px; min-width:0}
.acc-dot{
  width:10px; height:10px; border-radius:50%;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  box-shadow: 0 10px 20px rgba(14,165,233,.18);
}
.acc-title{font-weight: 900; white-space: nowrap; overflow:hidden; text-overflow: ellipsis}
.acc-meta{color: var(--muted); font-size: 12px; white-space: nowrap}
.acc-body{
  padding: 0 4px 12px 20px;
  color: var(--muted);
  font-size: 13px;
  display:none;
}
.acc-item.is-open .acc-body{display:block}

/* Quick actions — speed bump convex */
.qa{display:flex; flex-direction: column; gap: 10px; margin-top: 12px}
.qa-btn{
  display:flex; align-items:center; justify-content: space-between;
  gap: 12px;
  padding: 12px 12px;
  border-radius: 14px;
  border:1px solid rgba(200,210,225,.3);
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(235,240,248,.85));
  font-weight: 500;
  box-shadow:
    0 3px 6px rgba(15,23,42,.08),
    inset 0 2px 0 rgba(255,255,255,1),
    inset 0 -1px 0 rgba(15,23,42,.05);
  transition: transform .15s ease, box-shadow .15s ease;
}
.qa-btn:hover{
  transform: translateY(-1px);
  box-shadow:
    0 4px 10px rgba(15,23,42,.12),
    inset 0 2px 0 rgba(255,255,255,1),
    inset 0 -1px 0 rgba(15,23,42,.06);
}

/* Empty placeholder */
.empty{
  display:grid;
  place-items:center;
  padding: 42px 16px;
  text-align:center;
}
.empty-ico{font-size: 34px}
.empty-title{font-weight: 1000; font-size: 18px; margin-top: 8px}
.empty-sub{color: var(--muted); font-size: 13px; margin-top: 6px; max-width: 60ch}

/* Mobile responsiveness */
@media (max-width: 768px){
  .dash-shell{grid-template-columns: 1fr}
  .sidebar{
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-102%);
    transition: transform .18s ease;
    width: 280px;
    z-index: 30;
  }
  .sidebar.is-open{transform: translateX(0)}
}

@media (max-width: 980px){
  .hero{grid-template-columns: 1fr}
  .mini{grid-template-columns: 1fr}
  h1{font-size: 30px}
  .brand-logo{height:86px}
  .dash-grid{grid-template-columns: 1fr}
  .span-2{grid-column: auto}
  .search-wrap{min-width: 160px}
}


/* ---------------------------
   AUTH PAGES (LOGIN/REGISTER)
---------------------------- */
.auth-wrap{
  max-width: 520px;
  margin: 0 auto;
}
.auth-card{
  border:1px solid rgba(200,210,225,.3);
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(238,242,247,.88));
  border-radius: calc(var(--radius) + 6px);
  box-shadow:
    0 6px 16px rgba(15,23,42,.10),
    0 2px 4px rgba(15,23,42,.05),
    inset 0 2px 0 rgba(255,255,255,1),
    inset 0 -1px 0 rgba(15,23,42,.04);
  padding: 18px;
}
.auth-head{margin-bottom: 12px}
.auth-title{font-weight: 1000; font-size: 20px}
.auth-sub{color: var(--muted); font-size: 13px; margin-top: 3px}

.auth-form{display:flex; flex-direction: column; gap: 12px}
.field{display:flex; flex-direction: column; gap: 6px}
.label{font-weight: 900; font-size: 13px}
.input{
  border:1px solid rgba(200,210,225,.3);
  border-radius: 14px;
  padding: 11px 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(235,240,248,.85));
  outline: none;
  box-shadow:
    0 2px 4px rgba(15,23,42,.06),
    inset 0 2px 0 rgba(255,255,255,1),
    inset 0 -1px 0 rgba(15,23,42,.04);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus{border-color: rgba(14,165,233,.35); box-shadow: 0 0 0 4px rgba(14,165,233,.12)}

.row{display:flex; align-items:center; justify-content: space-between; gap: 10px; flex-wrap: wrap}
.check{display:flex; align-items:center; gap: 8px; color: var(--muted); font-weight: 700; font-size: 13px}
.link{color: var(--primary2); font-weight: 900}
.link:hover{text-decoration: underline}

.btn-block{width: 100%}

.auth-foot{
  display:flex;
  justify-content:center;
  gap: 8px;
  margin-top: 2px;
}

.note{
  margin-top: 8px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(15,23,42,.12);
  background: rgba(15,23,42,.03);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}


/* Inline logout form in nav */
.nav-form{display:inline; margin:0}
.nav-link-btn{background:transparent; cursor:pointer}
.nav-link-btn:hover{text-decoration:none}


/* Tables — speed bump convex */
.table{width:100%; border-collapse:separate; border-spacing:0 4px; font-size: 13px}
.table th{
  padding:12px 10px;
  text-align:left;
  font-weight: 1000;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(235,240,248,.85));
  border-top: 1px solid rgba(255,255,255,.85);
  border-bottom: 1px solid rgba(200,210,225,.25);
  box-shadow:
    0 2px 4px rgba(15,23,42,.06),
    inset 0 2px 0 rgba(255,255,255,1),
    inset 0 -1px 0 rgba(15,23,42,.04);
}
.table th:first-child{border-top-left-radius:12px; border-bottom-left-radius:12px}
.table th:last-child{border-top-right-radius:12px; border-bottom-right-radius:12px}
.table td{
  padding:10px 10px;
  border-top: 1px solid rgba(255,255,255,.80);
  border-bottom: 1px solid rgba(200,210,225,.20);
  text-align:left;
  background: transparent;
  font-weight: 400;
}
.table td strong, .table td a{
  font-weight: 400;
}
.pds-table td{
  font-weight: 400;
}
.pds-table td strong, .pds-table td a{
  font-weight: 400;
}
.table tbody tr{
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(240,243,248,.88));
  border-radius:12px;
  border: 1px solid rgba(200,210,225,.22);
  box-shadow:
    0 2px 4px rgba(15,23,42,.05),
    inset 0 1px 0 rgba(255,255,255,.9),
    inset 0 -1px 0 rgba(15,23,42,.03);
  transition: box-shadow .15s ease, transform .15s ease;
}
.table tbody tr:hover{
  box-shadow:
    0 3px 8px rgba(15,23,42,.10),
    inset 0 2px 0 rgba(255,255,255,1),
    inset 0 -1px 0 rgba(15,23,42,.05);
  transform: translateY(-1px);
}
.table tbody tr td:first-child{border-top-left-radius:12px; border-bottom-left-radius:12px}
.table tbody tr td:last-child{border-top-right-radius:12px; border-bottom-right-radius:12px}

/* === PDS PATCH v4: users page + pricing tree polish === */

/* More breathing room between stacked blocks */
.surface{ margin-bottom: 16px; }
.surface:last-child{ margin-bottom: 0; }

/* Pricing Catalog: slightly closer categories (but not touching) */
#pcCatalog{ gap: 10px !important; }
.pc-section.surface{ margin-bottom: 10px !important; }
.pc-section > div{ padding-top: 10px !important; }
#pcQuickPanels{ margin-bottom: 14px !important; }

/* Tree view lines (subtle) */
.pc-tree-node{ position: relative; }
.pc-tree-child{ margin-left: 14px; }
.pc-tree-child::before{
  content:"";
  position:absolute;
  left: -8px;
  top: 14px;
  bottom: 14px;
  width: 1px;
  background: rgba(17,24,39,.10);
}
.pc-tree-child summary::before{
  content:"";
  position:absolute;
  left: -8px;
  top: 20px;
  width: 10px;
  height: 1px;
  background: rgba(17,24,39,.10);
}

/* Dropdown icon: make it feel like a chevron */
.pc-arrow{
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  font-weight: 700;
}


/* ---------------------------
   MESSAGES / INBOX (Lab Dashboard)
   - Single outer border
   - Divider between thread list and chat
   - Thread list + message list scroll within the board
---------------------------- */
.pds-inbox{
  display:grid;
  grid-template-columns: 340px 1fr;
  gap:0;
  border:1px solid var(--line);
  border-radius: 16px;
  overflow:hidden;
  background: rgba(255,255,255,.92);
  /* Fill the dashboard content area (dash-content is a flex item with a definite height). */
  height: 100%;
  min-height: 0;
}

.pds-inbox-list,
.pds-inbox-thread{
  min-height: 0; /* required for nested scroll areas */
  display:flex;
  flex-direction: column;
}

.pds-inbox-list{
  border-right: 1px solid var(--line);
}

.pds-inbox-hdr{
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(247,249,252,.75);
}

.pds-inbox-list-body{
  flex: 1;
  min-height: 0;
  overflow:auto;
  padding: 0;
}

.pds-thread-item{
  display:block;
  padding: 12px 12px;
  border-radius: 12px;
  text-decoration:none;
  color: var(--text);
  border: 1px solid transparent;
  margin-bottom: 4px;
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(240,243,248,.85));
  box-shadow:
    0 2px 4px rgba(15,23,42,.05),
    inset 0 1px 0 rgba(255,255,255,.9),
    inset 0 -1px 0 rgba(15,23,42,.03);
  transition: transform .15s ease, box-shadow .15s ease;
}
.pds-thread-item:hover{
  transform: translateY(-1px);
  box-shadow:
    0 3px 6px rgba(15,23,42,.08),
    inset 0 2px 0 rgba(255,255,255,1),
    inset 0 -1px 0 rgba(15,23,42,.05);
}
.pds-thread-item.is-active{
  background: linear-gradient(180deg, rgba(230,245,255,.92), rgba(200,230,250,.82));
  box-shadow:
    0 2px 4px rgba(14,165,233,.08),
    inset 0 2px 0 rgba(255,255,255,.9),
    inset 0 -1px 0 rgba(14,165,233,.06);
}
.pds-thread-item:last-child{ margin-bottom: 0; }

.pds-thread-hdr{
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(247,249,252,.75);
  display:flex;
  justify-content: space-between;
  align-items:flex-start;
  gap: 12px;
}

.pds-thread-body{
  flex: 1;
  min-height: 0;
  overflow:auto;
  padding: 0;
  background: rgba(255,255,255,.65);
}

.pds-msg-row{
  display:flex;
  padding: 8px 14px;
  border-bottom: 0;
}
.pds-msg-row:first-child{ padding-top: 0; }
.pds-msg-row.is-lab{ justify-content: flex-end; }
.pds-msg-row.is-doctor{ justify-content: flex-start; }

.pds-msg-bubble{
  max-width: 78%;
  border: 1px solid rgba(200,210,225,.25);
  border-radius: 16px;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(240,243,248,.88));
  box-shadow:
    0 2px 4px rgba(15,23,42,.05),
    inset 0 1px 0 rgba(255,255,255,.9),
    inset 0 -1px 0 rgba(15,23,42,.03);
}
.pds-msg-row.is-lab .pds-msg-bubble{
  background: linear-gradient(180deg, rgba(230,245,255,.92), rgba(200,230,250,.82));
}

.pds-msg-line{ display:flex; align-items:flex-start; gap: 8px; }

.pds-msg-avatar{
  width: 20px;
  height: 20px;
  border-radius: 7px;
  object-fit: contain;
  border: 1px solid rgba(15,23,42,.12);
  background: rgba(255,255,255,.92);
  flex: 0 0 auto;
  margin-top: 2px;
}

.pds-msg-initial{
  width: 20px;
  height: 20px;
  border-radius: 999px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size: 11px;
  font-weight: 900;
  color: var(--muted);
  border: 1px solid rgba(15,23,42,.12);
  background: rgba(15,23,42,.04);
  flex: 0 0 auto;
  margin-top: 2px;
}

.pds-msg-text{ margin: 0; }
.pds-msg-name{ font-weight: 900; }
.pds-msg-body{ white-space: pre-wrap; }

.pds-msg-atts{ display:flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

.pds-thread-typing{
  padding: 6px 14px;
  font-size: 12px;
  color: var(--muted);
  min-height: 18px;
}

.pds-composer{
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.92);
  padding: 10px 12px;
  display:flex;
  gap: 10px;
  align-items:flex-end;
}

.pds-composer-left{flex:1; min-width: 0;}

.pds-composer textarea{
  width: 100%;
  resize: none;
  min-height: 48px;
  max-height: 140px;
}

.pds-composer-actions{
  display:flex;
  gap: 10px;
  align-items:center;
  flex-wrap: wrap;
  margin-top: 8px;
}

@media (max-width: 980px){
  .pds-inbox{ grid-template-columns: 1fr; height: auto; min-height: 0; }
  .pds-inbox-list{ border-right: 0; border-bottom: 1px solid var(--line); max-height: 280px; }
  .pds-thread-body{ min-height: 420px; }
}

/* Pencil icon button smaller */
.pc-edit-btn{
  width: 36px !important;
  justify-content: center;
}

/* ---------------------------
   DASHBOARD MESSAGES (INBOX)
   One unified frame with a divider (like a real chat inbox).
---------------------------- */
.pds-msg-shell{
  display:grid;
  grid-template-columns: 320px 1fr;
  gap:0;
  margin-top: 0;
  /* Fill the available viewport height inside the dashboard shell */
  height: calc(100vh - 170px);
  min-height: 560px;
  border:1px solid var(--line);
  border-radius: calc(var(--radius) + 6px);
  background: rgba(255,255,255,.92);
  box-shadow: var(--shadow);
  overflow:hidden;
}

.pds-msg-list{
  height:100%;
  min-height:0;
  overflow:auto;
  padding: 12px;
  border-right: 1px solid var(--line);
  background: rgba(255,255,255,.86);
}

.pds-msg-thread{
  height:100%;
  min-height:0;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  min-width:0;
  background: rgba(255,255,255,.92);
}

.pds-msg-thread-head{
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--line);
  display:flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.pds-msg-thread-body{
  flex:1;
  min-height:0;
  overflow:auto;
  padding: 12px 14px;
}

.pds-msg-thread-body .msg-row{
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.pds-msg-thread-body .msg-row:last-child{ border-bottom: 0; }

.pds-msg-placeholder{
  height:100%;
  display:grid;
  place-items:center;
  text-align:center;
  padding: 20px;
}

.pds-msg-composer-wrap{
  border-top: 1px solid var(--line);
  padding: 12px 14px;
  background: rgba(247,249,252,.75);
}

.pds-msg-toolbar{
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap: 10px;
  flex-wrap:wrap;
  margin-top: 6px;
}

.pds-msg-composer{
  display:flex;
  gap: 10px;
  align-items:flex-end;
  margin-top: 10px;
}

/* Conversation list items: subtle cards without heavy borders */
.pds-msg-list .thread-item{
  display:block;
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid transparent;
}
.pds-msg-list .thread-item:hover{
  background: rgba(15,23,42,.03);
  border-color: var(--line);
}
.pds-msg-list .thread-item.is-active{
  background: linear-gradient(135deg, rgba(14,165,233,.14), rgba(29,78,216,.06));
  border-color: rgba(14,165,233,.20);
}

@media (max-width: 980px){
  .pds-msg-shell{grid-template-columns: 1fr; height:auto; min-height:0;}
  .pds-msg-list{border-right:0; border-bottom:1px solid var(--line); max-height: 280px;}
  .pds-msg-thread{min-height: 520px;}
}
