/* ui-shell.css (P9.1)
 * Compact glass-card sitebar + unified sticky toolbars (A/B/C sites).
 * Goal: reduce header/toolbars height without changing layout logic.
 */

:root{
  /* Surfaces: prefer theme tokens if present */
  --sitebar-bg: var(--card, linear-gradient(180deg, var(--bg2, rgba(255,255,255,.22)), var(--bg1, rgba(255,255,255,.12))));
  --sitebar-border: var(--stroke, var(--border, rgba(255,255,255,.22)));
  --sitebar-shadow: var(--shadow, 0 18px 44px rgba(0,0,0,.26));
  --sitebar-radius: var(--radius, 20px);

  /* Pills */
  --pill-bg: rgba(255,255,255,.10);
  --pill-border: rgba(255,255,255,.18);
  --pill-hover: rgba(255,255,255,.14);
  --pill-active: rgba(255,255,255,.20);

  /* Toolbars */
  --toolbar-bg: var(--sitebar-bg);
  --toolbar-border: var(--sitebar-border);
  --toolbar-radius: var(--sitebar-radius);

  --sitebar-h: 64px; /* JS will update to real height */
}

/* -------------------------
   Sitebar (Header)
-------------------------- */
.sitebar{
  position: sticky;
  top: 0;
  z-index: 90;
  background: transparent;
}

/* For headers that wrap content in .container (A站) */
.sitebar > .container{
  padding-top: 10px;
  padding-bottom: 8px;
}

/* Glass card wrapper (recommended) */
.sitebar-card{
  border: 1px solid var(--sitebar-border);
  border-bottom-color: transparent;
  background: var(--sitebar-bg);
  border-radius: var(--sitebar-radius);
  box-shadow: var(--sitebar-shadow);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 10px 12px;
}

.sitebar .sitebar-top{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 0;
}

.sitebar .sitebar-sub{
  display:flex;
  align-items:center;
  gap: 8px;
  padding: 8px 0 0 0;
}

.sb-brand{
  display:flex;
  align-items:center;
  gap: 9px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.sb-brand-logo{
  width: 30px;
  height: 30px;
  border-radius: 10px;
  flex: 0 0 auto;
  overflow: hidden;
}
.sb-brand-logo--chip{
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 900;
  letter-spacing: .2px;
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.10);
}

.sb-brand-text{ min-width: 0; }
.sb-brand-title{
  font-weight: 900;
  font-size: 16px;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-brand-sub{
  font-size: 11px;
  opacity: .78;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-spacer{ flex: 1 1 auto; }

.sb-actions{
  display:flex;
  align-items:center;
  gap: 6px;
  flex: 0 0 auto;
}

.sb-search{
  flex: 1 1 320px;
  max-width: 520px;
}

.sb-search form{
  display:flex;
  gap: 8px;
  align-items:center;
}

.sb-nav{
  display:flex;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex: 1 1 auto;
}
.sb-nav::-webkit-scrollbar{ height:0; }

.sb-link{
  display:inline-flex;
  align-items:center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--pill-border);
  background: var(--pill-bg);
  color: inherit;
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
  user-select: none;
}
.sb-link:hover{ background: var(--pill-hover); }
.sb-link:active{ transform: translateY(0); }
.sb-link.active{
  background: var(--pill-active);
  border-color: rgba(255,255,255,.30);
}

/* Dropdowns via <details> */
.nav-dd{ position: relative; }
.nav-dd > summary{ list-style: none; }
.nav-dd > summary::-webkit-details-marker{ display:none; }
.nav-dd > summary.sb-link{ cursor: pointer; }

.nav-menu{
  position:absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  padding: 8px;
  background: var(--sitebar-bg);
  border: 1px solid var(--sitebar-border);
  border-radius: 14px;
  box-shadow: var(--sitebar-shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.nav-menu .menu-title{
  font-size: 12px;
  opacity: .75;
  padding: 6px 10px;
}

.nav-menu a{
  display:flex;
  align-items:center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  color: inherit;
  text-decoration:none;
}
.nav-menu a:hover{ background: rgba(255,255,255,.10); }
.nav-menu .menu-current{
  display:flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius:12px;
  color:inherit;
  opacity:.62;
}

.nav-menu .menu-divider{
  height:1px;
  background: rgba(255,255,255,.14);
  margin: 6px 4px;
}

.nav-menu .menu-btn{
  width:100%;
  display:flex;
  align-items:center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align:left;
  font: inherit;
}
.nav-menu .menu-btn:hover{ background: rgba(255,255,255,.10); }

@media (max-width: 860px){
  .sb-search{ display:none; }
}

@media (max-width: 640px){
  .sitebar > .container{ padding-top: 8px; padding-bottom: 6px; }
  .sitebar-card{ padding: 8px 10px; }
  .sitebar .sitebar-sub{ padding-top: 6px; gap: 6px; }
  .sb-brand-sub{ display:none; }
  .sb-link{ padding: 6px 9px; font-size: 12.5px; }
}

/* -------------------------
   Toolbars (Tabs/Filters/Export)
-------------------------- */
.toolbar{
  display:flex;
  align-items:center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border: 1px solid var(--toolbar-border);
  background: var(--toolbar-bg);
  border-radius: var(--toolbar-radius);
  box-shadow: 0 10px 26px rgba(0,0,0,.20);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.toolbar--sticky{
  position: sticky;
  top: calc(var(--sitebar-h, 64px) + 10px);
  z-index: 80;
}

.toolbar .tabs{
  display:flex;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex: 1 1 420px;
}
.toolbar .tabs::-webkit-scrollbar{ height:0; }

.toolbar .toolbar-mid{
  display:flex;
  gap: 8px;
  align-items:center;
  flex: 2 1 420px;
  flex-wrap: wrap;
}

.toolbar .toolbar-right{
  display:flex;
  gap: 8px;
  align-items:center;
  flex: 0 0 auto;
  margin-left: auto;
  flex-wrap: wrap;
}

.toolbar .filters{
  display:flex;
  gap: 8px;
  align-items:center;
  flex-wrap: wrap;
}

/* Make common inputs look aligned even if base css differs */
.toolbar input,
.toolbar select{
  min-height: 32px;
}
/* C merchant center shell */
.c-merchant-body{
  min-height:100vh;
  background:linear-gradient(135deg,#102233 0%,#172b36 48%,#35263d 100%);
  color:var(--txt,#f4f7fb);
}
.c-merchant-shell{min-height:100vh;display:flex;flex-direction:column;}
.c-merchant-topbar{
  position:sticky;
  top:0;
  z-index:90;
  width:calc(100% - 32px);
  max-width:1180px;
  margin:14px auto 0;
  min-height:72px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:12px 14px;
  border:1px solid rgba(255,255,255,.20);
  border-radius:16px;
  background:linear-gradient(180deg,rgba(255,255,255,.18),rgba(255,255,255,.08));
  box-shadow:0 14px 34px rgba(0,0,0,.24);
}
.c-merchant-brand{
  min-width:0;
  display:flex;
  align-items:center;
  gap:10px;
  color:inherit;
  text-decoration:none;
}
.c-merchant-logo{width:34px;height:34px;border-radius:10px;flex:0 0 auto;}
.c-merchant-brand b{display:block;font-size:17px;line-height:1.05;font-weight:900;}
.c-merchant-brand em{display:block;margin-top:3px;font-size:12px;font-style:normal;color:rgba(255,255,255,.68);}
.c-merchant-actions{display:flex;align-items:center;gap:8px;flex:0 0 auto;}
.c-merchant-actions .nav-menu{z-index:130;}
.c-merchant-content{
  width:calc(100% - 32px);
  max-width:1180px;
  margin:18px auto 34px;
}
.c-merchant-body .hero,
.c-merchant-body .card,
.c-merchant-body .toolbar,
.c-merchant-body .notice{border-radius:8px;}
.c-merchant-body .hero{margin-top:0;padding:24px;box-shadow:0 12px 28px rgba(0,0,0,.18);}
.c-merchant-body .hero h1{font-size:32px;}
.c-merchant-body .card{box-shadow:0 10px 24px rgba(0,0,0,.18);}
.c-merchant-footer{margin-top:22px;}
.merchant-empty-state{display:flex;align-items:center;justify-content:space-between;gap:16px;}
.merchant-empty-state h3{margin:0 0 6px;}
.merchant-section-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;}
.merchant-section-head h3{margin:0 0 6px;font-size:20px;}
.merchant-todo-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
  margin-top:14px;
}
.merchant-todo-grid--compact{grid-template-columns:repeat(2,minmax(0,1fr));}
.merchant-todo-item{
  min-height:82px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  gap:12px;
  padding:14px;
  border:1px solid rgba(255,255,255,.16);
  border-radius:8px;
  background:rgba(255,255,255,.07);
  color:inherit;
  text-decoration:none;
}
.merchant-todo-item:hover{background:rgba(255,255,255,.12);border-color:rgba(125,211,252,.35);}
.merchant-todo-item span{font-size:13px;color:rgba(255,255,255,.66);}
.merchant-todo-item b{font-size:16px;line-height:1.35;}
.merchant-module-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
}
.merchant-module{
  min-height:142px;
  display:flex;
  flex-direction:column;
  gap:10px;
  color:inherit;
  text-decoration:none;
}
.merchant-module:hover{border-color:rgba(125,211,252,.38);background:linear-gradient(180deg,rgba(255,255,255,.20),rgba(255,255,255,.10));}
.merchant-module span{font-size:18px;font-weight:800;}
.merchant-module b{font-size:13px;line-height:1.45;font-weight:500;color:rgba(255,255,255,.72);}
.merchant-module em{margin-top:auto;font-style:normal;font-size:13px;color:#9bdcff;}
@media (max-width: 760px){
  .c-merchant-topbar{width:calc(100% - 20px);margin-top:10px;min-height:64px;padding:10px;}
  .c-merchant-brand em{display:none;}
  .c-merchant-actions{gap:6px;}
  .c-merchant-actions .sb-link{padding:7px 9px;font-size:12px;}
  .c-merchant-content{width:calc(100% - 20px);margin-top:12px;}
  .c-merchant-body .hero{padding:20px;}
  .c-merchant-body .hero h1{font-size:28px;}
  .merchant-empty-state,
  .merchant-section-head{align-items:flex-start;flex-direction:column;}
  .merchant-todo-grid,
  .merchant-todo-grid--compact,
  .merchant-module-grid{grid-template-columns:1fr;}
}
