/* ── WRETAN v2.0 — Layout ────────────────────────────────────────────────── */

/* ── App Shell ─────────────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
}

#nav-root {
  display: contents;
}

/* ── Sidebar Overlay ─────────────────────────────────────────────────────── */

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 200;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: overlayIn 0.15s var(--ease);
}

.sidebar-overlay.visible {
  display: block;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100dvh;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-x: hidden;
  overflow-y: visible;
  transition:
    width 0.28s var(--ease),
    min-width 0.28s var(--ease);
  position: relative;
  z-index: 10;
  border-right: 1px solid var(--border);
}

body.sb-collapsed .sidebar {
  width: 0;
  min-width: 0;
}

body.sb-collapsed .icon-sidebar-open {
  display: none;
}

body.sb-collapsed .icon-sidebar-close {
  display: block;
}

.sidebar-header {
  height: var(--topbar-h);
  padding: 0 18px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
}

.brand-link:hover .wordmark em {
  filter: brightness(1.2);
}

.brand-link:hover .brand-icon {
  filter: brightness(1.2);
}

.brand-icon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  color: var(--accent);
}

.wordmark {
  font-family: var(--mono);
  font-size: 1.2rem;
  font-weight: 550;
  letter-spacing: 0.07em;
  color: var(--accent);
  white-space: nowrap;
}

.wordmark em {
  color: var(--accent);
  font-style: normal;
}

.version-tag {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.6rem;
  background: var(--bg2);
  color: var(--text3);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: var(--mono);
  letter-spacing: 0.04em;
  vertical-align: middle;
}

/* ── Nav body ────────────────────────────────────────────────────────────── */

.nav-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 10px 12px;
}

.nav-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 1px;
}

.nav-group-header {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 6px 6px;
}

.nav-group-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s ease;
}

.nav-group-rule {
  flex: 1;
  height: 1px;
  background: var(--accent);
  opacity: 0.6;
  transform: scaleX(0.92);
  transform-origin: left;
  transition:
    transform 0.25s ease,
    opacity 0.25s ease,
    background 0.25s ease;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  margin-bottom: 2px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  color: var(--text2);
  text-decoration: none;
  position: relative;
  min-width: 0;
  transition:
    background 0.18s ease,
    transform 0.15s ease,
    box-shadow 0.18s ease,
    color 0.18s ease;
}

.nav-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18%;
  height: 64%;
  width: 2px;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0;
  transform: scaleY(0.4);
  transition:
    opacity 0.15s ease,
    transform 0.18s ease;
}

.nav-link:hover {
  background: var(--accent-bg);
  transform: translateX(2px);
  color: var(--text);
  padding-right: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.nav-link.active {
  background: var(--accent-bg);
  color: var(--text);
  font-weight: 500;
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.18) inset;
  transform: translateX(2px);
}

.nav-link.active::before {
  opacity: 1;
  transform: scaleY(1);
}

.nav-link:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
  background: var(--accent-bg);
}

.nav-link:active {
  transform: translateX(1px) scale(0.99);
}

.nav-link .icon {
  width: 18px;
  height: 18px;
  color: var(--accent);
  opacity: 0.85;
  transition:
    transform 0.15s ease,
    opacity 0.15s ease,
    color 0.15s ease;
}

.nav-link:hover .icon {
  transform: scale(1.1);
}

/* ── Main Area ────────────────────────────────────────────────────────────── */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── Topbar ─────────────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  height: var(--topbar-h);
  padding: 0 22px;
  gap: 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  z-index: 5;
}

.topbar-toggle,
.breadcrumb-item {
  color: var(--accent);
  opacity: 0.85;
  transition: opacity 0.15s ease;
}

.breadcrumb-item .icon,
.topbar-toggle .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.topbar-toggle:hover,
.breadcrumb-item:hover {
  opacity: 1;
}

.topbar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.topbar-toggle svg {
  display: block;
}

.topbar-toggle .icon-sidebar-close {
  display: none;
}

body.sb-collapsed .topbar-toggle .icon-sidebar-open {
  display: none;
}

body.sb-collapsed .topbar-toggle .icon-sidebar-close {
  display: block;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.page-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--sans);
  min-width: 0;
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
}

.breadcrumb-home {
  flex-shrink: 0;
}

.breadcrumb-sep {
  color: var(--accent);
  font-size: 1rem;
  font-family: var(--mono);
  opacity: 0.85;
  user-select: none;
  flex-shrink: 0;
}

.breadcrumb-sep .icon {
  position: relative;
  top: -1px;
}

.breadcrumb-page {
  font-size: 0.85rem;
  font-weight: 600;
  overflow: hidden;
}

.breadcrumb-page span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

#live-clock {
  font-family: var(--sans);
  font-size: 0.72rem;
  color: var(--accent);
  opacity: 1;
  letter-spacing: 0.04em;
}

/* ── Content Area ─────────────────────────────────────────────────────────── */

.content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px 32px;
}

.content > * {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

/* ── View header ─────────────────────────────────────────────────────────── */

.view-header {
  margin-bottom: 24px;
}

.view-title {
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 9px;
}

.view-sub {
  font-size: 0.76rem;
  color: var(--text3);
  margin-top: 5px;
  line-height: 1.5;
}

/* ── Layout utilities ─────────────────────────────────────────────────────── */

.cols-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.cols-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.cols-4 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 12px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Hero/Dashboard ───────────────────────────────────────────────────── */

.hero {
  position: relative;
  overflow: hidden;
  padding: 0;
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero-heading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 0px;
}

/* ── Logo + Title ───────────────────────────────────────────────────── */

.hero-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
  animation: fadeSlideUp 0.6s var(--ease-out) 0.1s both;
}

.hero-logo-icon {
  width: 56px;
  height: 56px;
  background: var(--accent-bg);
  border: 1px solid var(--accent-bd);
  border-top: 1px solid rgba(var(--accent-rgb), 0.4);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
  box-shadow: 0 8px 24px rgba(var(--accent-rgb), 0.05);
}

.hero-logo-icon svg {
  width: 46px;
  height: 46px;
}

.hero-title {
  font-family: var(--sans);
  font-size: 3rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: var(--accent);
  line-height: 1;
  text-shadow: 0 0 24px rgba(var(--accent-rgb), 0.2);
  animation: fadeSlideUp 0.6s var(--ease-out) 0.2s both;
}

/* ── Description ───────────────────────────────────────────────────── */

.hero-desc {
  font-family: var(--mono);
  font-size: 1rem;
  color: var(--text2);
  line-height: 1.75;
  margin-bottom: 12px;
  max-width: 540px;
  animation: fadeSlideUp 0.6s var(--ease-out) 0.3s both;
}

/* ── Homepage sections ───────────────────────────────────────────────────── */

.home-section {
  margin-bottom: 24px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.section-header::before,
.section-header .section-rule {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--accent);
}

.section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}

.section-rule {
  flex: 1;
  height: 1px;
  background: var(--accent);
}

/* ── Hero Search ───────────────────────────────────────────────────── */

.hero-search {
  width: 100%;
  max-width: 540px;
  margin: 0 auto 12px auto;
  animation: fadeSlideUp 0.6s var(--ease-out) 0.4s both;
  transition: transform 0.2s var(--ease);
}

.hero-search:focus-within {
  transform: scale(1.01);
}

/* ── Feature cards grid ──────────────────────────────────────────────── */

.feature-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 16px;
  animation: fadeSlideUp 0.6s var(--ease-out) 0.5s both;
}

.feature-card {
  padding: 10px 30px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  flex: 1 1 210px;
  max-width: 210px;
}

.feature-card-icon {
  width: 40px;
  height: 40px;
  background: var(--accent-bg);
  border: 1px solid var(--accent-bd);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  color: var(--accent);
  flex-shrink: 0;
}

.feature-card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  text-align: center;
}

.feature-card-desc {
  font-size: 0.73rem;
  color: var(--text2);
  line-height: 1.6;
}

/* ── Tool cards grid ─────────────────────────────────────────────────────── */

.tool-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  animation: fadeSlideUp 0.6s var(--ease-out) 0.6s both;
}

.tool-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition:
    border-color 0.15s var(--ease),
    box-shadow 0.15s var(--ease),
    transform 0.15s var(--ease);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1 1 210px;
  max-width: 210px;
}

.tool-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(var(--accent-rgb), 0.05) 0%,
    transparent 60%
  );
  opacity: 0;
  transition: opacity 0.18s;
}

.tool-card:hover {
  border-color: var(--accent-bd);
  box-shadow:
    0 4px 20px rgba(var(--accent-rgb), 0.12),
    0 1px 4px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

.tool-card:hover::before {
  opacity: 1;
}

.tool-card-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-bg);
  border: 1px solid var(--accent-bd);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}

.tool-card:hover .tool-card-icon {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.tool-card-body {
  min-width: 0;
}

.tool-card-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.12s;
}

.tool-card:hover .tool-card-name {
  color: var(--accent);
}

.tool-card-desc {
  font-size: 0.69rem;
  color: var(--text3);
  line-height: 1.55;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-clamp: 2;
}

/* ── Bottom Nav (mobile) ────────────────────────────────────────────── */

.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottomnav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 150;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}

.bottom-nav-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
  height: var(--bottomnav-h);
  padding: 0 70px;
}

.bottom-nav-inner > .bottom-nav-btn:first-child {
  justify-self: start;
}

.bottom-nav-inner > :last-child {
  justify-self: end;
}

.bottom-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent);
  opacity: 0.8;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--sans);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: color 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-btn:hover,
.bottom-nav-btn.active {
  color: var(--accent);
  opacity: 1;
}

.bottom-nav-btn svg {
  display: block;
}

.bottom-nav-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-decoration: none;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-logo-ring {
  width: 38px;
  height: 38px;
  background: var(--accent-bg);
  border: 1.5px solid var(--accent-bd);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.15s,
    box-shadow 0.15s;
  color: var(--accent);
}

.bottom-nav-logo:active .bottom-nav-logo-ring {
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.15);
}

.bottom-nav-logo-label {
  font-size: 0.6rem;
  color: var(--text3);
  font-family: var(--mono);
  letter-spacing: 0.06em;
}

/* ── Bottom Sheet ────────────────────────────────────────────────────────── */

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  border-top: 1px solid var(--border);
  z-index: 300;
  transform: translateY(100%);
  transition: transform 0.3s var(--ease-out);
  max-height: 80dvh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-sheet.open {
  transform: translateY(0);
}

.bs-handle-wrap {
  padding: 10px 0 4px;
  display: flex;
  justify-content: center;
  cursor: grab;
  flex-shrink: 0;
}

.bs-handle {
  width: 36px;
  height: 4px;
  background: var(--border2);
  border-radius: 2px;
}

.bs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 20px 10px;
  flex-shrink: 0;
}

.bs-title {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-transform: uppercase;
}

.bs-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent);
  padding: 4px;
  border-radius: var(--radius-sm);
  transition:
    background 0.12s,
    color 0.12s;
  display: flex;
}

.bs-body {
  overflow-y: auto;
  padding: 10px 10px 10px;
  flex: 1;
}

.bs-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 1px;
}

.bs-group-header {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 6px 6px;
}

.bs-group-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s ease;
}

.bs-group-rule {
  flex: 1;
  height: 1px;
  background: var(--accent);
  opacity: 0.6;
  transform: scaleX(0.92);
  transform-origin: left;
  transition:
    transform 0.25s ease,
    opacity 0.25s ease,
    background 0.25s ease;
}

.bs-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  margin-bottom: 2px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  color: var(--text2);
  text-decoration: none;
  position: relative;
  min-width: 0;
  transition:
    background 0.18s ease,
    transform 0.15s ease,
    box-shadow 0.18s ease,
    color 0.18s ease;
}

.bs-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18%;
  height: 64%;
  width: 2px;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0;
  transform: scaleY(0.4);
  transition:
    opacity 0.15s ease,
    transform 0.18s ease;
}

.bs-link.active {
  background: var(--accent-bg);
  color: var(--text);
  font-weight: 500;
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.18) inset;
  transform: translateX(2px);
}

.bs-link.active::before {
  opacity: 1;
  transform: scaleY(1);
}

.bs-link:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
  background: var(--accent-bg);
}

.bs-link:active {
  transform: translateX(1px) scale(0.99);
}

.bs-link .icon {
  width: 18px;
  height: 18px;
  color: var(--accent);
  opacity: 0.85;
  transition:
    transform 0.15s ease,
    opacity 0.15s ease;
}

@keyframes heroSlide {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes overlayIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}
