/* Dakkada v2.0 — App Shell, Obsidian Navy Rail & Glass Topbar */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden { display: none !important; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* Obsidian Navy Left Rail */
.rail {
  width: var(--rail-w);
  flex-shrink: 0;
  background: var(--rail-bg);
  border-inline-end: 1px solid var(--rail-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  transition: transform 0.22s var(--ease);
}

.rail-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--rail-border);
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--rail-text-bright);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16.5px;
  letter-spacing: -0.02em;
  text-decoration: none !important;
}

.brand-glyph {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563EB 0%, #1E40AF 100%);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.brand-ver {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: #93C5FD;
  background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(59, 130, 246, 0.28);
  padding: 2px 6px;
  border-radius: 5px;
}

.rail-mode {
  padding: 12px 14px 6px;
}

.rail-mode-pill {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--rail-border);
  border-radius: 9px;
}

.rail-mode-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 30px;
  border-radius: 7px;
  border: 0;
  background: transparent;
  color: var(--rail-text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.rail-mode-btn:hover { color: var(--rail-text-bright); }
.rail-mode-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.rail-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.2) transparent;
}

.rail-sec-lbl {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748B;
  padding: 12px 10px 5px;
}

.rail-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  margin-bottom: 2px;
  border-radius: 8px;
  color: var(--rail-text);
  font-size: 13.2px;
  font-weight: 500;
  text-decoration: none !important;
  position: relative;
  border: 1px solid transparent;
  transition: background 0.14s var(--ease), color 0.14s var(--ease), border-color 0.14s var(--ease);
}

.rail-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--rail-text-bright);
}

.rail-link.active {
  background: var(--rail-active-bg);
  color: #FFFFFF;
  font-weight: 600;
  border-color: rgba(59, 130, 246, 0.28);
}

.rail-link.active::before {
  content: "";
  position: absolute;
  inset-inline-start: -1px;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 3px;
  background: #60A5FA;
}

.rail-link .rail-tag {
  margin-inline-start: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  background: rgba(59, 130, 246, 0.2);
  color: #93C5FD;
}

.rail-link .rail-tag.pct {
  background: rgba(22, 163, 74, 0.18);
  color: #86EFAC;
}

.rail-upsell {
  margin: 12px 4px 4px;
  padding: 11px 12px;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.11);
  border: 1px solid rgba(59, 130, 246, 0.24);
  color: #CBD5E1;
  font-size: 12px;
}

.rail-upsell strong {
  display: block;
  color: #fff;
  font-size: 12.5px;
  margin-bottom: 4px;
}

.rail-foot {
  padding: 12px 12px 14px;
  border-top: 1px solid var(--rail-border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.rail-user-box {
  flex: 1;
  min-width: 0;
}

.rail-user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--rail-text-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rail-user-mail {
  font-size: 11px;
  color: var(--rail-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Main Workspace */
.workspace {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Frosted Sticky Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-sub {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.credit-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 11px;
  border-radius: 9px;
  background: var(--surface-sunk);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none !important;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.credit-pill:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.credit-pill .cp-num {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--primary);
}

.credit-pill .cp-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.content-wrap {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 22px 24px 36px;
  flex: 1;
}

.legal-footer {
  width: 100%;
  max-width: 1360px;
  margin: auto auto 0;
  padding: 16px 24px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.legal-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.legal-footer a {
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
}

.legal-footer a:hover {
  color: var(--text);
  text-decoration: underline;
}

/* Simple vs Pro visibility */
body.ui-simple .pro-only { display: none !important; }
body.ui-pro .simple-only { display: none !important; }

/* Mobile Drawer & Responsive */
.mob-menu-btn {
  display: none;
}

.rail-backdrop {
  display: none;
}

@media (max-width: 960px) {
  .mob-menu-btn {
    display: inline-flex;
  }
  .rail {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    transform: translateX(-105%);
    box-shadow: var(--shadow-lg);
  }
  [dir="rtl"] .rail {
    transform: translateX(105%);
  }
  body.rail-open .rail {
    transform: translateX(0);
  }
  body.rail-open .rail-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.58);
    backdrop-filter: blur(2px);
    z-index: 35;
  }
  .topbar {
    padding: 0 14px;
  }
  .topbar-sub {
    display: none;
  }
  .content-wrap {
    padding: 16px 14px 28px;
  }
  .legal-footer {
    padding: 14px;
  }
}
