/* ============================================================
   Shell: IurisIQ "Docket" sidebar + topbar, Docket section heads
   and folder-tab client tiles. Loaded after styles.css; uses only
   the theme tokens (--primary, --paper-card, --rule, ...), so every
   theme in theme.js tints it.
   ============================================================ */
:root {
  --side-w: 252px;
  --side-w-collapsed: 72px;
  --side-bg: color-mix(in srgb, var(--primary) 18%, #14171f);
  --pinstripe: repeating-linear-gradient(90deg, transparent, transparent 3px, rgba(255,255,255,0.018) 3px, rgba(255,255,255,0.018) 4px);
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--side-w);
  background: var(--side-bg);
  background-image: var(--pinstripe);
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 200;
  display: flex; flex-direction: column;
  box-shadow: 2px 0 24px rgba(0,0,0,.22);
  transition: width .22s cubic-bezier(.16,1,.3,1), transform .22s cubic-bezier(.16,1,.3,1);
}

.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  height: 66px; padding: 0 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  overflow: hidden;
}
.sidebar-seal {
  width: 36px; height: 36px; flex: none;
  border-radius: 50%;
  background: var(--primary);
  border: 1px solid rgba(255,255,255,.18);
  overflow: hidden;
}
.sidebar-seal img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.04); } /* trims the white corners of a round logo */
.sidebar-brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.sidebar-name {
  font-family: var(--font-display);
  font-size: 16px; font-weight: 500; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-tagline {
  font-family: var(--font-mono);
  font-size: 9px; color: rgba(255,255,255,.5);
  letter-spacing: .22em; text-transform: uppercase; margin-top: 3px;
  white-space: nowrap;
}

/* Collapse chevron, on the sidebar's edge */
.sidebar-collapse-btn {
  position: absolute; top: 52px; right: -12px;
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--paper-card);
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
  z-index: 1;
  transition: transform .22s, color .15s;
}
.sidebar-collapse-btn:hover { color: var(--primary); }
.sidebar-collapse-btn svg {
  width: 14px; height: 14px;
  stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
}

.sidebar .sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto; overflow-x: hidden;
}
.sidebar .nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border-left: 0;
  color: rgba(255,255,255,.62);
  font-size: 13.5px; font-weight: 500; letter-spacing: .01em;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.sidebar .nav-item svg { width: 18px; height: 18px; opacity: .85; }
.sidebar .nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar .nav-item.active {
  background: color-mix(in srgb, var(--primary) 34%, transparent);
  color: #fff;
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--primary) 70%, #ffffff);
}
.sidebar .nav-item.active svg { opacity: 1; }
.nav-label { overflow: hidden; text-overflow: ellipsis; }

.sidebar .sidebar-footer {
  display: flex; flex-direction: row; align-items: center; gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.07);
  overflow: hidden;
}
.sidebar-avatar {
  width: 30px; height: 30px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--primary) 45%, #14171f);
  color: #fff; font-size: 12px; font-weight: 600; text-transform: uppercase;
}
.sidebar-user {
  font-family: var(--font-mono); font-size: 11px; color: rgba(255,255,255,.6);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Collapsed: icons only */
.sidebar-collapsed .sidebar { width: var(--side-w-collapsed); }
.sidebar-collapsed .sidebar-brand { padding: 0 18px; }
.sidebar-collapsed .sidebar-brand-text,
.sidebar-collapsed .nav-label,
.sidebar-collapsed .sidebar-user { display: none; }
.sidebar-collapsed .sidebar .nav-item { justify-content: center; padding: 11px 0; }
.sidebar-collapsed .sidebar .sidebar-footer { justify-content: center; padding: 14px 0; }
.sidebar-collapsed .sidebar-collapse-btn { transform: rotate(180deg); }

/* Content beside the sidebar */
.main-wrapper {
  margin-left: var(--side-w);
  min-height: 100vh;
  transition: margin-left .22s cubic-bezier(.16,1,.3,1);
}
.sidebar-collapsed .main-wrapper { margin-left: var(--side-w-collapsed); }

/* ── Topbar: IurisIQ gradient, from the theme colour ─────── */
.main-wrapper .topbar {
  background:
    var(--pinstripe),
    linear-gradient(170deg,
      color-mix(in srgb, color-mix(in srgb, var(--primary) 78%, #6b7f9e) 84%, transparent) 0%,
      color-mix(in srgb, color-mix(in srgb, var(--primary) 55%, #1c2a44) 86%, transparent) 50%,
      color-mix(in srgb, color-mix(in srgb, var(--primary) 30%, #060b16) 93%, transparent) 100%);
  --pinstripe: repeating-linear-gradient(90deg, transparent, transparent 3px, rgba(255,255,255,0.02) 3px, rgba(255,255,255,0.02) 4px);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0,0,0,.18);
  color: #fff;
}
.main-wrapper .topbar-inner { max-width: none; }
.topbar-title {
  font-family: var(--font-display);
  font-size: 19px; font-weight: 500; color: #fff; letter-spacing: .005em;
  margin-right: auto;
}
.main-wrapper .topbar-meta,
.main-wrapper .topbar-meta-label { color: rgba(255,255,255,.62); }
.main-wrapper .topbar-date { color: #fff; }
.main-wrapper .topbar-status { color: #9be7c4; }
.main-wrapper .topbar-dot { background: #5fd3a0; box-shadow: 0 0 0 3px rgba(95,211,160,.22); }
.main-wrapper .user-email { color: rgba(255,255,255,.7); }
.main-wrapper .topbar-kebab { color: #fff; }
.main-wrapper .topbar-kebab svg { fill: currentColor; }

.sidebar-toggle {
  display: none;
  width: 38px; height: 38px; border-radius: 8px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18);
  color: #fff; place-items: center;
}
.sidebar-toggle svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }

.sidebar-scrim {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(10,12,18,.45);
}
.sidebar-scrim[hidden] { display: none; }

/* Phone / small tablet: off-canvas sidebar */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); width: var(--side-w); }
  .sidebar-open .sidebar { transform: none; }
  .sidebar-collapse-btn { display: none; }
  .main-wrapper,
  .sidebar-collapsed .main-wrapper { margin-left: 0; }
  /* Collapsed only applies on desktop */
  .sidebar-collapsed .sidebar { width: var(--side-w); }
  .sidebar-collapsed .sidebar-brand-text,
  .sidebar-collapsed .nav-label,
  .sidebar-collapsed .sidebar-user { display: revert; }
  .sidebar-collapsed .sidebar .nav-item { justify-content: flex-start; padding: 10px 12px; }
  .sidebar-toggle { display: grid; }
  .main-wrapper .topbar-inner { padding: 0 16px; }
  .main-wrapper .topbar-meta,
  .main-wrapper .user-email { display: none; }
  .main-content { padding: 24px 16px 48px; }
}

/* ── Docket section heads (Profile) ──────────────────────── */
.dk-sec-head,
#tab-profile .fp-section legend,
#tab-profile .upload-card > h3 {
  display: flex; align-items: baseline; gap: 13px;
  width: 100%;
  margin-bottom: 18px; padding: 0;
  font-family: var(--font-display);
  font-size: 19px; font-weight: 600; line-height: 1.2;
  color: var(--primary-dark);
}
.dk-sec-head::after,
#tab-profile .fp-section legend::after,
#tab-profile .upload-card > h3::after {
  content: ''; flex: 1; height: 1px; background: var(--rule);
}
#tab-profile .upload-card > h3 { margin-bottom: 12px !important; }
/* The legend sits inside the card rather than on its border */
#tab-profile .fp-section { padding: 20px 22px 22px; border-width: 1px; }
#tab-profile .fp-section legend { float: left; }
#tab-profile .fp-section legend + * { clear: both; }

/* ── Docket folder-tab client tiles ──────────────────────── */
.client-grid { row-gap: 26px; padding-top: 10px; }
.client-card {
  --c: var(--primary);
  overflow: visible;
  border: 1px solid var(--rule);
  border-top: 3px solid var(--c);
  border-radius: 4px var(--radius-lg) var(--radius-lg) var(--radius-lg);
  background: var(--paper-card);
}
.client-card:nth-child(4n+2) { --c: color-mix(in srgb, var(--primary) 65%, #c79633); }
.client-card:nth-child(4n+3) { --c: color-mix(in srgb, var(--primary) 60%, #5f8f6e); }
.client-card:nth-child(4n+4) { --c: color-mix(in srgb, var(--primary) 55%, #8a6aa8); }
/* The folder tab */
.client-card::before {
  top: -10px; left: -1px;
  width: 52px; height: 10px;
  border-radius: 7px 7px 0 0;
  background: var(--c);
  transform: none;
  transition: width .2s cubic-bezier(.16,1,.3,1);
}
.client-card:hover { border-color: var(--rule); border-top-color: var(--c); }
.client-card:hover::before { transform: none; width: 72px; }
.client-card-name { font-family: var(--font-display); font-size: 16.5px; font-weight: 600; }
.client-card-anum { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .03em; }
.client-card-docs { border-top-style: dashed; }

/* ── Back (previous tab) ─────────────────────────────────── */
.topbar-back {
  display: inline-flex; align-items: center; gap: 5px;
  height: 32px; padding: 0 12px 0 8px; border-radius: 999px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2);
  color: #fff; font-size: 12.5px; font-weight: 600; letter-spacing: .02em;
  transition: background .15s;
}
.topbar-back:hover { background: rgba(255,255,255,.2); }
.topbar-back[hidden] { display: none; }
.topbar-back svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 900px) { .topbar-back span { display: none; } .topbar-back { padding: 0 8px; } }

/* ── Theme picker icon in the header ─────────────────────── */
.topbar-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; padding: 0;
  background: transparent; border: 1.5px solid transparent; border-radius: 10px;
  color: #fff; cursor: pointer; transition: background .15s, border-color .15s;
}
.topbar-icon-btn:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.22); }
.topbar-icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.topbar-icon-btn svg circle { fill: currentColor; stroke: none; }

/* ── IurisIQ themes (theme.js): the light ground and grid, as Light ─────── */
:root[data-theme="lightblue"] body, :root[data-theme="sage"] body, :root[data-theme="navy"] body,
:root[data-theme="teal"] body, :root[data-theme="brass"] body, :root[data-theme="rose"] body {
  background-image: var(--grid);
  background-size: 22px 22px;
}
:root[data-theme="lightblue"] .login-page, :root[data-theme="sage"] .login-page, :root[data-theme="navy"] .login-page,
:root[data-theme="teal"] .login-page, :root[data-theme="brass"] .login-page, :root[data-theme="rose"] .login-page {
  background: var(--bg);
  background-image: var(--grid);
  background-size: 22px 22px;
}

/* ── Bedazzled (IurisIQ): the pink sequin tile, and a sparkly title font ── */
:root[data-theme="bedazzled"] body,
:root[data-theme="bedazzled"] .login-page {
  background-color: #fbd3df;
  background-image:
    linear-gradient(rgba(255, 245, 250, 0.30), rgba(255, 245, 250, 0.30)),
    url("../img/bedazzled.jpg");
  background-size: auto, 700px 350px;
  background-repeat: no-repeat, repeat;
  background-attachment: fixed;
}
:root[data-theme="bedazzled"] .topbar-title,
:root[data-theme="bedazzled"] .topbar-date {
  font-family: 'Codystar', var(--font-display);
  letter-spacing: .06em;
}
