/* ==== DocForge — app shell, sidebar, topbar, login ==== */

#app-shell { display: flex; min-height: 100%; }

/* ---------------------------------------------------------------- sidebar --*/
/* The sidebar carries the brand ramp — the same navy-to-blue the hero and the
   primary button use — so the chrome reads as one designed surface rather
   than a grey rail. Every dark rule is scoped under .sidebar: .brand and
   .avatar are reused on light surfaces (login card, admin table, settings). */

.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  background: linear-gradient(180deg, #14283D 0%, var(--pri-deep) 55%, #1B4A6E 100%);
  color: rgba(255, 255, 255, .82);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -.02em;
}
.sidebar .brand { position: relative; border-bottom: 0; color: #fff; }
.sidebar .brand::after {
  content: '';
  position: absolute;
  left: 14px; right: 14px; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .18), transparent);
}
.brand-mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: var(--grad-brand);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  box-shadow: 0 2px 6px rgba(31, 95, 139, .35), inset 0 1px 0 rgba(255, 255, 255, .25);
  flex: 0 0 30px;
}
.sidebar .brand-mark { box-shadow: 0 0 0 1px rgba(255, 255, 255, .25), 0 2px 8px rgba(0, 0, 0, .3); }
/* The Nexus Health mark on a white tile: the navy artwork needs a light ground
   on the dark sidebar, and the tile keeps the same footprint as the old "DF". */
.brand-mark-img { background: #fff; padding: 3px; }
.brand-mark-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -.02em; }
.brand-org {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .55);
}
.login-card .brand-org, .login-side .brand-org { color: var(--txt-faint); }

.nav { padding: 12px 10px; flex: 1; overflow-y: auto; }

.nav-section {
  padding: 14px 10px 6px;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .45);
}
.nav-section:first-child { padding-top: 2px; }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  margin-bottom: 2px;
  border-radius: 8px;
  color: rgba(255, 255, 255, .78);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
  font-size: 13.5px;
  font-weight: 500;
}
.nav-item:hover { background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; }
.nav-item .icon { color: rgba(255, 255, 255, .55); transition: color var(--transition); }
.nav-item:hover .icon { color: rgba(255, 255, 255, .85); }

.nav-item.active {
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
}
.nav-item.active .icon { color: #fff; }
/* A short bar in the gutter reads as "you are here" faster than colour alone. */
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 20px;
  border-radius: 0 4px 4px 0;
  background: #8FD3FF;
  box-shadow: 0 0 10px rgba(143, 211, 255, .6);
}
.nav-item:focus-visible { outline-color: #8FD3FF; }

.sidebar-foot { padding: 12px; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  border-radius: var(--radius);
  font-size: 13px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .12);
}
.avatar {
  width: 29px; height: 29px;
  border-radius: 50%;
  background: var(--grad-brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 650;
  font-size: 11.5px;
  flex: 0 0 29px;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--pri-border);
}
.sidebar .avatar { background: #fff; color: var(--pri); box-shadow: 0 0 0 1px rgba(255, 255, 255, .3); }
.user-chip .meta { min-width: 0; flex: 1; line-height: 1.3; }
.user-chip .name { font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .role { font-size: 11.5px; color: rgba(255, 255, 255, .55); }
.sidebar .btn-ghost { color: rgba(255, 255, 255, .7); }
.sidebar .btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, .1); color: #fff; }

/* ------------------------------------------------------------------- main --*/

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  /* A faint brand wash behind the content, visible through the glass topbar. */
  background: radial-gradient(900px 380px at 100% -80px, rgba(31, 95, 139, .07), transparent 60%);
}

.topbar {
  height: var(--topbar-h);
  flex: 0 0 var(--topbar-h);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 { font-size: 15px; margin: 0; font-weight: 600; }

.crumbs {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--txt-muted);
  min-width: 0;
}
.crumbs a { color: var(--txt-muted); }
.crumbs a:hover { color: var(--txt); }
.crumbs .icon { color: var(--txt-faint); }
.crumbs .current {
  color: var(--txt);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 44ch;
}

/* A stacking context of its own, so a view can put a watermark behind its
   cards (negative z-index) without it sinking beneath the page background. */
#view-container { padding: 24px; flex: 1; position: relative; z-index: 0; }
.view-narrow { max-width: 720px; }
.view-wide { max-width: 1180px; }

.page-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}
.page-head h1 { margin: 0 0 3px; font-size: 22px; letter-spacing: -.02em; }
.page-head p { margin: 0; color: var(--txt-muted); max-width: 62ch; }
.page-head .actions { display: flex; gap: 8px; align-items: center; flex: 0 0 auto; }

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 26px 0 12px;
}
.section-head h2 { margin: 0; font-size: 15px; }
.section-head .hint { margin: 0; }

/* ------------------------------------------------------------------ login --*/
/* A split screen: the brand on the left — the navy ramp, a faint white mark
   bleeding off the corner, what the app does in three lines — and the sign-in
   card on the right. It should read as the front door of a product, not a
   form floating in grey. */

#login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 44%) minmax(0, 1fr);
}
.login-side {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px 48px 32px;
  color: #fff;
  background:
    radial-gradient(640px 320px at 100% 0%, rgba(255, 255, 255, .12), transparent 60%),
    radial-gradient(520px 420px at 0% 100%, rgba(143, 211, 255, .14), transparent 60%),
    linear-gradient(160deg, #14283D 0%, var(--pri-deep) 48%, #1E5A82 100%);
}
.login-side-wm {
  position: absolute;
  right: -14%;
  bottom: -12%;
  width: 78%;
  max-width: 620px;
  opacity: .07;
  pointer-events: none;
  user-select: none;
}
.login-side-body { position: relative; max-width: 460px; }
.login-side-logo { height: 96px; width: auto; display: block; margin-bottom: 34px; }
.login-side h1 {
  color: #fff;
  font-size: 34px;
  line-height: 1.08;
  letter-spacing: -.026em;
  margin: 0 0 12px;
}
.login-side-tag {
  font-size: 15px;
  line-height: 1.55;
  color: rgba(255, 255, 255, .8);
  margin: 0 0 30px;
  max-width: 42ch;
}
.login-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.login-points li { display: flex; align-items: flex-start; gap: 12px; font-size: 13.5px; line-height: 1.5; color: rgba(255, 255, 255, .88); }
.login-points strong { display: block; font-weight: 650; color: #fff; }
.login-points .icon-well {
  background: rgba(255, 255, 255, .12);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
  flex-basis: 30px;
}
.login-points .icon-well .icon { color: #fff; }
.login-side-foot {
  position: relative;
  margin: 40px 0 0;
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .5);
}

.login-main {
  display: grid;
  place-items: center;
  padding: 32px 24px;
  background:
    radial-gradient(760px 420px at 70% 0%, rgba(31, 95, 139, .08), transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 34px 34px 28px;
}
.login-card .brand { border: 0; height: auto; padding: 0 0 20px; }
.login-logo { height: 64px; width: auto; display: block; margin: 0 0 22px; }
.login-card h2 { margin: 0 0 4px; font-size: 21px; letter-spacing: -.02em; }
.login-card .sub { color: var(--txt-muted); margin-bottom: 22px; font-size: 13.5px; }
.login-card .input { padding: 9px 12px; }
.login-foot {
  margin: 20px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--txt-faint);
}
.login-foot .dot { margin: 0 6px; opacity: .6; }

@media (max-width: 900px) {
  #login-page { grid-template-columns: minmax(0, 1fr); }
  .login-side { padding: 28px 24px 22px; }
  .login-side-logo { height: 64px; margin-bottom: 20px; }
  .login-side h1 { font-size: 26px; }
  .login-points { display: none; }
  .login-side-foot { margin-top: 18px; }
  .login-side-wm { width: 60%; right: -18%; bottom: -30%; }
}

/* ---------------------------------------------------------------- responsive --*/

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform var(--transition);
    box-shadow: var(--shadow-xl);
  }
  .sidebar.open { transform: none; }
  #view-container { padding: 16px; }
  .page-head { flex-wrap: wrap; }
}
@media (min-width: 901px) {
  #menu-toggle { display: none; }
}
