/* Page chrome: header, toolbars, view wrappers, pagination.
   Anything that positions regions of the page rather than styling a
   self-contained component. */

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
  background: var(--dark-grad);
  padding: 0 32px; height: var(--hh);
  display: flex; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .04), 0 4px 20px rgba(0, 0, 0, .3);
}
.logo { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; cursor: pointer; }
.logo-mark {
  width: 42px; height: 42px; flex-shrink: 0;
  border-radius: 8px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.logo-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.logo-txt { min-width: 0; }
.logo-name {
  color: #f1f5f9; font-size: .95rem; font-weight: 600;
  letter-spacing: -.02em; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.logo-sub {
  color: #64748b; font-size: .72rem; font-weight: 400; letter-spacing: .01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.hdr-pill {
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  color: #94a3b8; font-size: .75rem; font-weight: 500;
  padding: 5px 13px; border-radius: 99px;
  white-space: nowrap; flex-shrink: 0; letter-spacing: .01em;
}
.hdr-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex-shrink: 0;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 10px; cursor: pointer; color: #94a3b8;
  transition: background .15s, color .15s;
}
.hdr-icon-btn:hover { background: rgba(255, 255, 255, .11); color: #e2e8f0; }
.hdr-badge {
  position: absolute; top: -5px; right: -5px;
  background: var(--red); color: #fff;
  font-size: .62rem; font-weight: 700; line-height: 1;
  padding: 3px 5px; border-radius: 99px; min-width: 16px; text-align: center;
}
.hdr-wrap { position: relative; display: inline-flex; flex-shrink: 0; }

/* Sync status dot */
.sync-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: #64748b; transition: background .3s; cursor: default;
}
.sync-dot.syncing { background: var(--amber); animation: pulse-sync .8s ease-in-out infinite alternate; }
.sync-dot.ok { background: var(--green); }
.sync-dot.err { background: var(--red); }
@keyframes pulse-sync { from { opacity: .5; } to { opacity: 1; } }

/* ── Toolbars ────────────────────────────────────────────────────────────── */
.tb-wrap { background: var(--surface); border-bottom: 1px solid var(--border); }
.toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 32px 10px; flex-wrap: wrap;
}
.toolbar2 {
  display: flex; align-items: center; gap: 8px;
  padding: 0 32px 14px; flex-wrap: wrap;
}
.tb-sep { width: 1px; height: 22px; background: var(--border); flex-shrink: 0; }

.search-wrap { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.search-wrap svg {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; fill: none; stroke: var(--text3);
  stroke-width: 2; pointer-events: none;
}
.search-wrap input {
  width: 100%; padding: 9px 13px 9px 36px;
  border: 1.5px solid var(--border); border-radius: 11px;
  font-family: inherit; font-size: .875rem; color: var(--text);
  background: var(--bg); transition: border-color .15s, box-shadow .15s, background .15s;
}
.search-wrap input:focus {
  outline: none; background: var(--surface); border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .1);
}

/* Compact select used across the filter row */
.fsel {
  padding: 7px 11px; border: 1.5px solid var(--border); border-radius: 10px;
  font-family: inherit; font-size: .8rem; font-weight: 500; color: var(--text2);
  background: var(--surface); cursor: pointer; max-width: 220px;
  transition: border-color .15s, color .15s;
}
.fsel:hover { border-color: var(--border2); }
.fsel:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, .1); }
.fsel.active { border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* Grid / table view toggle */
.view-tog { display: flex; background: var(--bg2); border-radius: 10px; padding: 3px; gap: 2px; flex-shrink: 0; }
.vbtn {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 28px; border: none; background: transparent;
  border-radius: 8px; cursor: pointer; color: var(--text3);
  transition: background .15s, color .15s;
}
.vbtn:hover { color: var(--text2); }
.vbtn.act { background: var(--surface); color: var(--accent); box-shadow: var(--sh-xs); }

/* Dropdown menus (Tools, Import/Export) */
.dd-wrap { position: relative; flex-shrink: 0; }
.dd-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 60;
  min-width: 210px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--sh-md);
  display: none;
}
.dd-wrap.open .dd-menu { display: block; }
.dd-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 10px; border: none; background: transparent;
  border-radius: 8px; cursor: pointer;
  font-family: inherit; font-size: .83rem; font-weight: 500; color: var(--text);
  text-align: left; transition: background .12s;
}
.dd-item:hover { background: var(--bg2); }
.dd-item:disabled { opacity: .5; cursor: not-allowed; }
.dd-label {
  padding: 7px 10px 4px; font-size: .66rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; color: var(--text3);
}
.dd-sep { height: 1px; background: var(--border); margin: 5px 0; }

/* ── View wrappers ───────────────────────────────────────────────────────── */
.gw { padding: 22px 32px 40px; }
.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.tbl-wrap { padding: 22px 32px 40px; overflow-x: auto; }

.rcount { font-size: .78rem; color: var(--text3); font-weight: 500; white-space: nowrap; }

/* ── Board ───────────────────────────────────────────────────────────────── */
.board-wrap { padding: 22px 32px 40px; overflow-x: auto; }
.board-groupby { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.board-groupby-lbl { font-size: .78rem; color: var(--text3); font-weight: 600; }
.board-gbtn {
  padding: 6px 14px; border-radius: 99px; border: 1.5px solid var(--border2);
  background: var(--bg2); color: var(--text2);
  font-family: inherit; font-size: .8rem; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.board-gbtn:hover { background: var(--border2); }
.board-gbtn.act { background: var(--accent); border-color: var(--accent); color: #fff; }

.board-cols { display: flex; align-items: flex-start; gap: 16px; }
.board-col {
  flex: 0 0 260px; width: 260px;
  background: var(--bg2); border: 1.5px solid var(--border); border-radius: var(--r-lg);
  display: flex; flex-direction: column;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.board-col.drag-over { border-color: var(--accent); background: var(--accent-dim); }
.board-col-h {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.board-col-title {
  font-size: .85rem; font-weight: 700; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.board-col-count {
  background: var(--surface); color: var(--text2); flex-shrink: 0;
  border-radius: 99px; padding: 2px 9px; font-size: .72rem; font-weight: 700;
}
.board-col-body {
  padding: 12px; display: flex; flex-direction: column; gap: 10px;
  max-height: 70vh; overflow-y: auto;
}
.board-card { cursor: grab; }
.board-card:active { cursor: grabbing; }

/* ── Pagination ──────────────────────────────────────────────────────────── */
.pager {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 32px 48px; flex-wrap: wrap;
}
.pgb {
  min-width: 34px; height: 34px; padding: 0 10px;
  border: 1.5px solid var(--border); background: var(--surface);
  border-radius: 9px; cursor: pointer;
  font-family: inherit; font-size: .82rem; font-weight: 500; color: var(--text2);
  transition: background .15s, border-color .15s, color .15s;
}
.pgb:hover:not(:disabled) { background: var(--bg2); border-color: var(--border2); }
.pgb.act { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.pgb:disabled { opacity: .4; cursor: not-allowed; }
.pg-gap { color: var(--text3); padding: 0 3px; font-size: .82rem; }
.pg-info { font-size: .78rem; color: var(--text3); margin-right: 8px; }
.pg-size { margin-left: 10px; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  header { padding: 0 16px; gap: 10px; }
  .logo-sub { display: none; }
  .toolbar, .toolbar2 { padding-left: 16px; padding-right: 16px; }
  .gw, .tbl-wrap { padding: 16px 16px 32px; }
  .pager { padding: 0 16px 36px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
}
@media (max-width: 560px) {
  .search-wrap { max-width: none; min-width: 0; }
  .fsel { max-width: 150px; }
  .pg-info, .pg-size { display: none; }
  /* Passive info, not controls — dropped first so the header's actual
   * buttons (including sign-out) stay reachable. See the overflow-x note in
   * base.css for why "reachable" is not just a layout nicety here: an
   * overflowing header was pushing the drawer's own close button off the
   * side of a real phone screen. */
  #hdr-count, #hdr-user { display: none; }
  header { padding: 0 12px; gap: 8px; }
}
