/*
 * Hydra employee portal
 * Shared application shell and responsive navigation.
 */

:root {
  color-scheme: dark;
  --sidebar-width: 96px;
  --page-width: 1180px;
  --bg: #080a0c;
  --bg-elevated: #0d1114;
  --surface: #11171b;
  --surface-raised: #161e23;
  --surface-hover: #1b252b;
  --border: #29343a;
  --border-strong: #3c4a51;
  --text: #edf7f8;
  --text-muted: #99a8ae;
  --text-faint: #6f7e84;
  --accent: #18c6d1;
  --accent-strong: #56e1e8;
  --accent-soft: rgba(24, 198, 209, 0.13);
  --danger: #ff7777;
  --success: #5ed49a;
  --warning: #f1c66d;
  --focus: #7ce9ef;
  --radius-sm: 7px;
  --radius: 11px;
  --radius-lg: 16px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
  --transition: 160ms ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 82% -20%, rgba(24, 198, 209, 0.08), transparent 34rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

body,
button,
input,
select,
textarea {
  font: inherit;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--accent-strong);
  text-underline-offset: 0.2em;
}

a:hover {
  color: #b2f8fb;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

::selection {
  background: rgba(24, 198, 209, 0.35);
  color: #fff;
}

.visually-hidden,
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 12px;
  z-index: 200;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--bg);
  font-weight: 750;
  text-decoration: none;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  min-height: 100vh;
}

.sidebar-toggle__checkbox {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  left: -9999px;
}

.sidebar-toggle {
  position: fixed;
  left: 22px;
  bottom: 22px;
  z-index: 110;
  display: grid;
  width: 52px;
  height: 52px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 13px;
  background: rgba(17, 23, 27, 0.96);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.44);
  transition:
    color var(--transition),
    border-color var(--transition),
    background var(--transition);
}

.sidebar-toggle:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
  color: var(--accent-strong);
}

.sidebar-toggle span,
.sidebar-toggle span::before,
.sidebar-toggle span::after {
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition:
    transform var(--transition),
    opacity var(--transition);
}

.sidebar-toggle span {
  position: relative;
}

.sidebar-toggle span::before,
.sidebar-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
}

.sidebar-toggle span::before {
  top: -7px;
}

.sidebar-toggle span::after {
  top: 7px;
}

#sidebarToggle:checked + .sidebar-toggle span,
#sidebarToggle:checked ~ .sidebar-toggle span {
  background: transparent;
}

#sidebarToggle:checked + .sidebar-toggle span::before,
#sidebarToggle:checked ~ .sidebar-toggle span::before {
  top: 0;
  transform: rotate(45deg);
  background: currentColor;
}

#sidebarToggle:checked + .sidebar-toggle span::after,
#sidebarToggle:checked ~ .sidebar-toggle span::after {
  top: 0;
  transform: rotate(-45deg);
  background: currentColor;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 100;
  display: flex;
  width: var(--sidebar-width);
  min-height: 100vh;
  flex-direction: column;
  align-items: center;
  border-right: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(24, 198, 209, 0.045), transparent 25%),
    rgba(8, 10, 12, 0.985);
  box-shadow: 8px 0 30px rgba(0, 0, 0, 0.16);
  transition: transform 220ms ease;
}

.sidebar__logo {
  display: flex;
  width: 100%;
  min-height: 118px;
  padding: 13px 10px 8px;
  align-items: center;
  justify-content: center;
}

.sidebar__logo a {
  display: block;
  border-radius: 9px;
}

.sidebar__logo img {
  width: 74px;
  max-height: 102px;
  object-fit: contain;
  filter: saturate(0.9) contrast(1.05);
}

.sidebar__main {
  display: flex;
  width: 100%;
  min-height: 0;
  flex: 1;
  align-items: center;
  justify-content: center;
}

.sidebar__nav {
  display: flex;
  width: 100%;
  margin: 0;
  padding: 10px 0;
  list-style: none;
  flex-direction: column;
  align-items: center;
  gap: 11px;
}

.sidebar__nav li {
  margin: 0;
  padding: 0;
}

.sidebar__nav a {
  position: relative;
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-muted);
  text-decoration: none;
  transition:
    color var(--transition),
    border-color var(--transition),
    background var(--transition),
    transform var(--transition);
}

.sidebar__nav a:hover,
.sidebar__nav a.active,
.sidebar__nav a[aria-current="page"] {
  border-color: rgba(24, 198, 209, 0.52);
  background: var(--accent-soft);
  color: var(--accent-strong);
  transform: translateY(-1px);
}

.sidebar__nav a.active::before,
.sidebar__nav a[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -23px;
  width: 3px;
  height: 25px;
  border-radius: 0 4px 4px 0;
  background: var(--accent);
  box-shadow: 0 0 15px rgba(24, 198, 209, 0.62);
}

.sidebar__nav .icon {
  display: grid;
  place-items: center;
  line-height: 0;
}

.sidebar__nav .icon svg,
.sidebar__nav svg {
  width: 23px;
  height: 23px;
}

.sidebar__nav .text {
  position: absolute;
  top: 50%;
  left: calc(100% + 18px);
  z-index: 120;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #141b1f;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.34);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.25;
  opacity: 0;
  pointer-events: none;
  transform: translate(-6px, -50%);
  transition:
    opacity var(--transition),
    transform var(--transition);
  white-space: nowrap;
}

.sidebar__nav a:hover .text,
.sidebar__nav a:focus-visible .text {
  opacity: 1;
  transform: translate(0, -50%);
}

.sidebar__bottom {
  display: flex;
  width: 100%;
  padding-bottom: 85px;
  justify-content: center;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  visibility: hidden;
  background: rgba(0, 0, 0, 0.68);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 220ms ease,
    visibility 220ms ease;
}

.app-main {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  transition: margin-left 220ms ease;
}

.content {
  width: min(100%, calc(var(--page-width) + 48px));
  margin: 0 auto;
  padding: clamp(28px, 5vw, 58px) 24px 72px;
}

.content--narrow {
  width: min(100%, 840px);
}

.content > :first-child {
  margin-top: 0;
}

.page-header {
  display: flex;
  margin-bottom: 28px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.page-header__copy {
  min-width: 0;
}

.page-title,
.content > h1,
.page-header h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.85rem, 4vw, 2.55rem);
  font-weight: 760;
  letter-spacing: -0.035em;
  line-height: 1.13;
}

.page-subtitle {
  max-width: 760px;
  margin: 8px 0 0;
  padding: 0;
  color: var(--text-muted);
  font-size: 0.98rem;
  text-align: left;
}

.page-meta {
  color: var(--text-faint);
  font-size: 0.88rem;
}

@media (min-width: 861px) {
  #sidebarToggle:checked ~ .sidebar {
    transform: translateX(-100%);
  }

  #sidebarToggle:checked ~ .app-main {
    margin-left: 0;
  }
}

@media (max-width: 860px) {
  .sidebar {
    overflow-y: auto;
    transform: translateX(-100%);
  }

  .sidebar__main {
    min-height: auto;
    flex: 0 0 auto;
    align-items: flex-start;
  }

  .sidebar__bottom {
    padding-bottom: 0;
  }

  .sidebar__bottom .sidebar__nav {
    padding-top: 0;
  }

  #sidebarToggle:checked ~ .sidebar {
    transform: translateX(0);
  }

  #sidebarToggle:checked ~ .sidebar-backdrop {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
  }

  .app-main {
    margin-left: 0;
  }

  .content {
    padding-top: 86px;
  }

  .page-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .content {
    padding-right: 16px;
    padding-bottom: 54px;
    padding-left: 16px;
  }

  .sidebar-toggle {
    top: 18px;
    bottom: auto;
    left: 16px;
    width: 48px;
    height: 48px;
  }

  .page-title,
  .content > h1,
  .page-header h1 {
    font-size: 1.75rem;
  }
}

@media (max-height: 760px) {
  .sidebar__logo {
    min-height: 82px;
    padding-top: 8px;
  }

  .sidebar__logo img {
    width: 57px;
    max-height: 70px;
  }

  .sidebar__nav {
    gap: 7px;
  }

  .sidebar__nav a {
    width: 45px;
    height: 45px;
  }

  .sidebar__bottom {
    padding-bottom: 70px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  .sidebar,
  .sidebar-toggle,
  .sidebar-backdrop,
  .skip-link {
    display: none !important;
  }

  .app-main {
    margin: 0;
  }
}
