/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── VARIABLES ── */
:root {
  --amber-50:  #FAEEDA;
  --amber-100: #FAC775;
  --amber-200: #EF9F27;
  --amber-400: #BA7517;
  --amber-600: #854F0B;
  --amber-800: #633806;
  --amber-900: #412402;
  --blue-50:   #EAF2FB;
  --blue-200:  #5BA4D4;
  --blue-800:  #1A4A6B;
  --green-50:  #EAF3DE;
  --green-200: #72B043;
  --green-800: #27500A;
  --purple-50: #F0EAFB;
  --purple-200:#9B72D4;
  --purple-800:#3A1A6B;
  --teal-50:   #E5F5F2;
  --teal-200:  #3AADA0;
  --teal-800:  #1A5550;
  --red-50:    #FBEAEA;
  --red-200:   #D46262;
  --red-800:   #6B1A1A;
  --gray-50:  #F5F4F2;
  --gray-100: #E8E7E3;
  --gray-200: #CCCBC5;
  --gray-400: #8A8982;
  --gray-600: #5A5955;
  --gray-700: #3E3D3A;
  --gray-800: #2E2D2B;
  --gray-900: #1A1917;
  --sidebar-w: 220px;
  --font: 'DM Sans', system-ui, sans-serif;
  --mono: 'DM Mono', 'Courier New', monospace;
}

/* ── BASE ── */
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--gray-800);
  background: var(--gray-50);
  display: flex;
  flex-direction: column;
}

/* ── TOPBAR ── */
.topbar {
  height: 52px;
  background: #fff;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
  z-index: 10;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.topbar-logo {
  width: 28px;
  height: 28px;
  background: var(--amber-200);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--amber-900);
  flex-shrink: 0;
}
.topbar-name     { font-size: 15px; font-weight: 500; color: var(--gray-900); }
.topbar-divider  { width: 1px; height: 20px; background: var(--gray-200); }
.topbar-subtitle { font-size: 13px; color: var(--gray-400); }
.topbar-nav      { display: flex; align-items: center; gap: 4px; margin-left: 8px; }
.topbar-nav-item {
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 7px;
  cursor: pointer;
  color: var(--gray-600);
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
}
.topbar-nav-item:hover  { background: var(--gray-50); color: var(--gray-900); }
.topbar-nav-item.active { background: var(--amber-50); color: var(--amber-800); font-weight: 500; }

.topbar-search { margin-left: auto; position: relative; width: 220px; }
.topbar-search .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--gray-400);
  pointer-events: none;
}
.topbar-search input {
  width: 100%;
  height: 34px;
  padding: 0 34px 0 34px;
  font-family: var(--font);
  font-size: 13px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--gray-50);
  color: var(--gray-800);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.topbar-search input:focus        { border-color: var(--amber-200); background: #fff; }
.topbar-search input::placeholder { color: var(--gray-400); }
.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  font-size: 16px;
  display: none;
  padding: 2px;
  line-height: 1;
  z-index: 1;
}
.search-clear:hover { color: var(--gray-800); }

/* ── SCROLLBAR ── */
::-webkit-scrollbar       { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ── MOBILE SHARED COMPONENTS ── */
.mobile-back { display: none; }
.mobile-nav  { display: none; }

@media (max-width: 700px) {
  /* Topbar: collapse to logo + search */
  .topbar          { padding: 0 12px; gap: 8px; }
  .topbar-divider  { display: none; }
  .topbar-subtitle { display: none; }
  .topbar-nav      { display: none; }
  .topbar-search   { width: auto; flex: 1; min-width: 0; margin-left: 0; }

  /* Back button (shown inside detail pane) */
  .mobile-back {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    background: #fff;
    border: none;
    border-bottom: 1px solid var(--gray-100);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    color: var(--amber-800);
    cursor: pointer;
    width: 100%;
    text-align: left;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-back i { font-size: 18px; }

  /* Bottom tab nav */
  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #fff;
    border-top: 1px solid var(--gray-100);
    z-index: 200;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .mobile-nav-item {
    flex: 1;
    height: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--gray-400);
    text-decoration: none;
    font-size: 10px;
    font-family: var(--font);
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-nav-item i      { font-size: 22px; }
  .mobile-nav-item.active { color: var(--amber-600); }
}
