/* =========================================================
   Layout: login screen, app shell, topbar, sidebar
   ========================================================= */

/* ---------------------------------- login ---------------------------------- */

.login {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1100px 520px at 12% -10%, rgba(0, 162, 185, .22), transparent 60%),
    radial-gradient(900px 500px at 100% 110%, rgba(11, 139, 153, .20), transparent 60%),
    linear-gradient(160deg, #0d2b33 0%, #123a44 55%, #0b2129 100%);
}

.login__card {
  width: min(420px, 100%);
  padding: 34px 32px 24px;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-3);
}

.login__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 22px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.login__logo { width: 54px; height: 54px; border-radius: 12px; }
.login__name { font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.login__sub { font-size: 12.5px; color: var(--ink-400); }

.login__form { margin-bottom: 6px; }

.login__error {
  min-height: 20px;
  margin: -4px 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--danger);
}

.login__hint {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 12.5px;
  text-align: center;
}
.login__hint:empty { display: none; }

.login__foot {
  margin-top: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-400);
}

/* ---------------------------------- app shell ---------------------------------- */

.app { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: 62px;
  padding: 0 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-1);
}

.topbar__menu { display: inline-flex; }

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-900);
  text-decoration: none;
}
.topbar__brand:hover { text-decoration: none; }
.topbar__logo { width: 34px; height: 34px; border-radius: 8px; }
.topbar__title { font-size: 16.5px; font-weight: 500; letter-spacing: -.01em; white-space: nowrap; }
.topbar__title b { font-weight: 800; color: var(--teal-600); }

.topbar__search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 420px;
  margin-inline-start: 12px;
  padding: 0 12px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--ink-400);
}
.topbar__search:focus-within {
  border-color: var(--teal-500);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(0, 162, 185, .14);
}
.topbar__search input {
  border: 0;
  background: transparent;
  min-height: 38px;
  padding: 0;
  font-size: 14px;
}
.topbar__search input:focus { box-shadow: none; }

.topbar__results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 340px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-2);
  z-index: 60;
}
.topbar__result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  font: inherit;
  font-size: 14px;
  text-align: left;
  color: var(--ink-700);
  cursor: pointer;
}
.topbar__result:last-child { border-bottom: 0; }
.topbar__result:hover { background: var(--teal-050); }
.topbar__result small { color: var(--ink-400); }
.topbar__results .topbar__none { padding: 12px 14px; font-size: 13.5px; color: var(--ink-400); }

.topbar__actions { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; }

/* ---------------------------------- shell ---------------------------------- */

.shell { display: flex; flex: 1; min-height: 0; }

.sidebar {
  display: flex;
  flex-direction: column;
  width: 232px;
  flex: none;
  padding: 14px 12px;
  background: var(--surface);
  border-inline-end: 1px solid var(--line);
  overflow-y: auto;
  transition: width .18s ease;
}

.navlabel {
  margin: 16px 10px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-400);
}

.navitem {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  padding: 0 11px;
  border-radius: var(--r-md);
  color: var(--ink-700);
  font-size: 14.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color .12s, color .12s;
}
.navitem:hover { background: var(--surface-2); text-decoration: none; }
.navitem svg { flex: none; color: var(--ink-400); }

.navitem.is-active {
  background: var(--teal-050);
  color: var(--teal-600);
  font-weight: 700;
}
.navitem.is-active svg { color: var(--teal-500); }

.sidebar__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding: 14px 11px 4px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-500);
}

.main {
  flex: 1;
  min-width: 0;
  padding: 26px 28px 56px;
  outline: none;
}

@media (max-width: 960px) {
  .topbar__search { margin-inline-start: 0; max-width: none; }
  .topbar__actions .btn span { display: none; }

  .sidebar {
    position: fixed;
    top: 62px;
    bottom: 0;
    inset-inline-start: 0;
    z-index: 50;
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: var(--shadow-3);
  }
  .sidebar.is-open { transform: translateX(0); }
  .main { padding: 20px 16px 48px; }
}

/* ------------------------------ collapsible sidebar (desktop rail) ------------------------------ */

@media (min-width: 961px) {
  body.nav-collapsed .sidebar { width: 64px; padding: 14px 8px; }

  body.nav-collapsed .navlabel { display: none; }

  body.nav-collapsed .navitem {
    justify-content: center;
    padding: 0;
    gap: 0;
  }
  /* visually hidden but still the accessible name + native tooltip source */
  body.nav-collapsed .navitem span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }

  body.nav-collapsed .sidebar__foot { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}

@media (max-width: 640px) {
  .topbar__title { display: none; }
  .topbar { gap: 8px; padding: 0 10px; }
}
