/*
 * Priority Board — Frontend Styles
 * Scoped under #pb-root to avoid conflicts with Enfold/other themes.
 */

/* ── CSS Variables ── */
#pb-root {
  --pb-bg:      #f2f1ee;
  --pb-white:   #ffffff;
  --pb-border:  #e6e3db;
  --pb-text:    #181818;
  --pb-muted:   #888880;
  --pb-r:       18px;
  --pb-rsm:     11px;
  --pb-sh:      0 2px 8px rgba(0,0,0,0.06);
  --pb-sh-lg:   0 12px 40px rgba(0,0,0,0.14);

  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 14px;
  background: var(--pb-bg);
  color: var(--pb-text);
  min-height: 100vh;
  box-sizing: border-box;

  /* Teleported to <body> via JS — just fill full width naturally */
  width: 100%;
  position: relative;
  overflow-x: hidden;
}

#pb-root *, #pb-root *::before, #pb-root *::after {
  box-sizing: border-box;
}
/* Explicit resets only where needed — NOT padding:0 globally,
   which would nuke all button/input padding via ID-specificity override */
#pb-root .pb-gate-card *:not(button):not(input):not(select):not(textarea):not(label) {
  margin: 0;
}

/* ── GATE (landing / password / error screens) ── */
.pb-gate {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}
.pb-gate-card {
  width: 100%;
  max-width: 420px;
  background: var(--pb-white);
  border: 1px solid var(--pb-border);
  border-radius: 24px;
  padding: 36px 32px;
  box-shadow: var(--pb-sh-lg);
  display: flex;
  flex-direction: column;
  gap: 0;
}
.pb-gate-header { margin-bottom: 28px; }
.pb-gate-logo {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.05em;
  margin-bottom: 8px;
  color: var(--pb-text);
}
.pb-gate-sub {
  color: var(--pb-muted);
  font-size: 13px;
  line-height: 1.6;
}
.pb-gate-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pb-gate-divider {
  text-align: center;
  font-size: 11px;
  color: var(--pb-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 4px 0;
}
.pb-create-form {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--pb-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pb-form-optional {
  font-weight: 400;
  font-size: 10px;
  color: var(--pb-muted);
  text-transform: none;
  letter-spacing: 0;
  margin-left: 4px;
}
.pb-gate-footer {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--pb-border);
  font-size: 12px;
  color: var(--pb-muted);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pb-gate-text-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--pb-text);
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: var(--pb-border);
  text-underline-offset: 3px;
  transition: text-decoration-color .15s;
}
.pb-gate-text-btn:hover { text-decoration-color: var(--pb-text); }
.pb-gate-error {
  background: #fde8e8;
  color: #900;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 12px;
  line-height: 1.5;
}
.pb-gate-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pb-btn-full {
  width: 100%;
  justify-content: center;
  padding: 14px 20px;
  font-size: 14px;
  border-radius: 14px;
}
.pb-share-box {
  background: #f7f6f3;
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 16px;
}
.pb-share-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--pb-muted);
  margin-bottom: 8px;
}
.pb-share-url {
  font-size: 11.5px;
  font-weight: 500;
  word-break: break-all;
  overflow-wrap: anywhere;
  color: var(--pb-text);
  background: var(--pb-white);
  border: 1px solid var(--pb-border);
  border-radius: 8px;
  padding: 8px 11px;
  margin-bottom: 8px;
  max-width: 100%;
}

/* ── TOPBAR ── */
.pb-topbar {
  position: sticky;
  top: 10px;
  z-index: 100;
  margin: 10px 16px 0;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--pb-border);
  border-radius: var(--pb-r);
  padding: 11px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  box-shadow: var(--pb-sh);
}
.pb-brand {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.04em;
  flex-shrink: 0;
  min-width: max-content;
  user-select: none;
}
.pb-topbar-meta {
  font-size: 11.5px;
  color: var(--pb-muted);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pb-save-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: #fff8e6;
  color: #8a5c00;
  flex-shrink: 0;
  transition: all .2s;
}
.pb-save-indicator.clean {
  background: transparent;
  color: var(--pb-muted);
}
.pb-save-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e6a800;
  flex-shrink: 0;
}
.pb-save-indicator.clean .pb-save-dot { background: #aaa; }

/* Sync status pill */
.pb-sync-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  flex-shrink: 0;
  transition: all .2s;
}
.pb-sync-status.synced  { background: #e6f7ee; color: #1a6b3a; }
.pb-sync-status.polling { background: #f0f0f0; color: var(--pb-muted); }
.pb-sync-status.conflict{ background: #fde8e8; color: #900; }
.pb-sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.pb-topbar-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.pb-view-toggle { display: flex; background: #ebebeb; border-radius: 10px; overflow: hidden; flex-shrink: 0; }
.pb-view-btn {
  border: none;
  background: none;
  padding: 6px 13px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: var(--pb-muted);
  border-radius: 10px;
  transition: all .15s;
}
.pb-view-btn.active { background: var(--pb-text); color: #fff; }

/* ── BUTTONS ── */
#pb-root .pb-btn {
  border: 0;
  border-radius: 13px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: transform .1s, opacity .12s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}
#pb-root .pb-btn:active { transform: scale(.97); }
#pb-root .pb-btn-dark   { background: var(--pb-text); color: #fff; }
#pb-root .pb-btn-light  { background: #ebebeb; border: 1.5px solid #d8d8d8; color: var(--pb-text); }
#pb-root .pb-btn-accent { background: #fff3d0; color: #5c3d00; }
#pb-root .pb-btn-danger { background: #fce8e8; color: #900; }
#pb-root .pb-btn-ghost  { background: none; border: 1.5px solid var(--pb-border); color: var(--pb-text); }
#pb-root .pb-btn:hover  { opacity: .82; }
#pb-root .pb-btn-sm  { padding: 8px 14px; font-size: 12px; border-radius: 10px; }
#pb-root .pb-btn-xs  { padding: 4px 8px; font-size: 11px; border-radius: 8px; font-weight: 700; border: 0; cursor: pointer; transition: opacity .12s; }
#pb-root .pb-btn-xs:hover { opacity: .75; }
.pb-icon-btn {
  width: 32px; height: 32px;
  border: 0; border-radius: 10px;
  background: #ebebeb; cursor: pointer;
  font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s; flex-shrink: 0;
}
.pb-icon-btn:hover { background: #ddd; }

/* ── FILTER BAR ── */
.pb-filter-bar { margin: 12px 16px 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pb-chip {
  border: 1.5px solid var(--pb-border);
  background: var(--pb-white);
  border-radius: 999px;
  padding: 5px 12px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  color: var(--pb-muted);
  transition: all .12s;
  display: inline-flex; align-items: center; gap: 5px;
}
.pb-chip.active { background: var(--pb-text); color: #fff; border-color: var(--pb-text); }
.pb-chip:hover:not(.active) { border-color: #999; color: var(--pb-text); }
.pb-chip-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ── BOARD ── */
.pb-board-scroll { overflow-x: auto; padding: 14px 16px 48px; min-height: calc(100vh - 130px); }
.pb-board { display: flex; gap: 12px; align-items: flex-start; min-width: max-content; }
.pb-column { width: 268px; flex-shrink: 0; }
.pb-col-header {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 11px;
  background: var(--pb-white);
  border: 1px solid var(--pb-border);
  border-radius: var(--pb-r) var(--pb-r) 0 0;
  border-bottom: 2px solid var(--pb-col-color, var(--pb-border));
}
.pb-col-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--pb-col-color, #ccc); flex-shrink: 0; }
.pb-col-title { font-size: 13px; font-weight: 800; flex: 1; letter-spacing: -.01em; }
.pb-col-count { font-size: 10.5px; color: var(--pb-muted); background: #f0f0f0; padding: 2px 7px; border-radius: 999px; font-weight: 700; }
.pb-col-add { background: none; border: none; cursor: pointer; color: var(--pb-muted); font-size: 19px; line-height: 1; padding: 0 1px; transition: color .12s; font-weight: 400; }
.pb-col-add:hover { color: var(--pb-text); }
.pb-col-body {
  min-height: 60px;
  background: rgba(255,255,255,0.5);
  border: 1px solid var(--pb-border);
  border-top: none;
  border-radius: 0 0 var(--pb-r) var(--pb-r);
  padding: 8px;
  display: flex; flex-direction: column; gap: 7px;
  transition: background .15s;
}
.pb-col-body.drag-over { background: rgba(0,0,0,0.04); }

/* ── CARD ── */
.pb-card {
  background: var(--pb-white);
  border: 1px solid var(--pb-border);
  border-left: 3px solid var(--pb-col-color, var(--pb-border));
  border-radius: var(--pb-rsm);
  padding: 10px 11px;
  cursor: pointer;
  box-shadow: var(--pb-sh);
  transition: box-shadow .15s, transform .12s;
  position: relative;
}
.pb-card:hover { box-shadow: 0 4px 18px rgba(0,0,0,0.1); transform: translateY(-1px); }
.pb-card.dragging { opacity: .45; transform: scale(.98); }
.pb-card.is-child { margin-left: 8px; border-left-color: var(--pb-cat-color, var(--pb-border)); }
.pb-card-row { display: flex; align-items: flex-start; gap: 7px; }
.pb-cat-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pb-cat-color, #ccc); flex-shrink: 0; margin-top: 4px; }
.pb-card-title { font-size: 12.5px; font-weight: 600; line-height: 1.4; flex: 1; }
.pb-today-star { background: none; border: none; cursor: pointer; font-size: 14px; opacity: .25; padding: 0; flex-shrink: 0; transition: opacity .12s; line-height: 1; }
.pb-today-star:hover, .pb-today-star.on { opacity: 1; }
.pb-card-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.pb-badge { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.pb-badge-cat     { color: var(--bc); background: color-mix(in srgb, var(--bc) 14%, transparent); }
.pb-badge-cost    { background: #fff4d6; color: #8a5000; }
.pb-badge-sub     { background: #f0f0f0; color: var(--pb-muted); }
.pb-badge-today   { background: #fff4d6; color: #8a5000; }
.pb-badge-blocked { background: #fde8e8; color: #900; }

/* ── TODAY VIEW ── */
.pb-today-wrap { max-width: 580px; margin: 0 auto; padding: 24px 14px 60px; }
.pb-today-head { margin-bottom: 26px; }
.pb-today-title { font-size: 24px; font-weight: 800; letter-spacing: -.04em; margin-bottom: 3px; }
.pb-today-sub { font-size: 12px; color: var(--pb-muted); }
.pb-today-section { margin-bottom: 22px; }
.pb-today-sec-label { font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--pb-muted); margin-bottom: 9px; padding-bottom: 7px; border-bottom: 1px solid var(--pb-border); }
.pb-today-card { background: var(--pb-white); border: 1px solid var(--pb-border); border-radius: var(--pb-rsm); padding: 11px 13px; margin-bottom: 6px; display: flex; align-items: center; gap: 10px; cursor: pointer; transition: box-shadow .12s; }
.pb-today-card:hover { box-shadow: var(--pb-sh); }
.pb-tc-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.pb-tc-info { flex: 1; min-width: 0; }
.pb-tc-title { font-size: 12.5px; font-weight: 600; }
.pb-tc-parent { font-size: 10.5px; color: var(--pb-muted); margin-top: 2px; }
.pb-tc-remove { background: none; border: none; cursor: pointer; color: #ccc; font-size: 12px; transition: color .12s; padding: 2px; }
.pb-tc-remove:hover { color: #c00; }
.pb-today-empty { text-align: center; padding: 60px 20px; }
.pb-today-empty-icon { font-size: 40px; margin-bottom: 12px; }
.pb-today-empty-msg { color: var(--pb-muted); font-size: 13px; line-height: 1.6; margin-bottom: 20px; }

/* ── MOBILE ACCORDION ── */
.pb-col-accordion { background: var(--pb-white); border: 1px solid var(--pb-border); border-radius: var(--pb-r); margin-bottom: 10px; overflow: hidden; }
.pb-col-acc-header { display: flex; align-items: center; gap: 8px; padding: 13px 14px; cursor: pointer; border: none; background: none; width: 100%; text-align: left; font: inherit; }
.pb-col-acc-chevron { font-size: 10px; color: var(--pb-muted); transition: transform .18s; margin-left: auto; }
.pb-col-accordion.is-open .pb-col-acc-chevron { transform: rotate(90deg); }
.pb-col-acc-body { padding: 0 10px 10px; display: none; gap: 7px; flex-direction: column; }
.pb-col-accordion.is-open .pb-col-acc-body { display: flex; }

/* ── MODAL ── */
.pb-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.38); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; opacity: 0; pointer-events: none; transition: opacity .18s; }
.pb-overlay.open { opacity: 1; pointer-events: all; }
.pb-modal { background: var(--pb-white); border-radius: 22px; width: 100%; max-width: 480px; max-height: 92vh; overflow-y: auto; box-shadow: var(--pb-sh-lg); transform: translateY(8px); transition: transform .18s; }
.pb-overlay.open .pb-modal { transform: translateY(0); }
.pb-modal-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--pb-border); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--pb-white); border-radius: 22px 22px 0 0; }
.pb-modal-title { font-size: 17px; font-weight: 800; letter-spacing: -.03em; }
.pb-modal-close {
  background: #f0f0f0;
  border: none;
  cursor: pointer;
  font-size: 17px;
  color: var(--pb-muted);
  line-height: 1;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .12s, color .12s;
}
.pb-modal-close:hover { background: #e0e0e0; color: var(--pb-text); }
.pb-modal-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.pb-modal-foot { padding: 13px 20px; border-top: 1px solid var(--pb-border); display: flex; justify-content: space-between; align-items: center; gap: 8px; position: sticky; bottom: 0; background: var(--pb-white); border-radius: 0 0 22px 22px; }

/* ── FORMS ── */
.pb-form-group { display: flex; flex-direction: column; gap: 5px; }
.pb-form-label { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--pb-muted); }
#pb-root .pb-form-input { border: 1.5px solid var(--pb-border); border-radius: 11px; padding: 10px 14px; font: inherit; font-size: 13px; color: var(--pb-text); background: var(--pb-white); width: 100%; transition: border-color .15s; margin: 0; }
#pb-root .pb-form-input:focus { outline: none; border-color: var(--pb-text); }
textarea.pb-form-input { resize: vertical; min-height: 70px; }
.pb-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pb-sub-box { background: #f7f6f3; border-radius: 11px; padding: 11px 12px; }
.pb-sub-box-title { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--pb-muted); margin-bottom: 8px; }
.pb-sub-item { display: flex; align-items: center; gap: 7px; padding: 4px 0; font-size: 12px; }
.pb-sub-item-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.pb-sub-input-row { display: flex; gap: 7px; margin-top: 9px; }
.pb-sub-input { flex: 1; border: 1.5px solid var(--pb-border); border-radius: 9px; padding: 6px 10px; font: inherit; font-size: 12px; background: var(--pb-white); }
.pb-sub-input:focus { outline: none; border-color: var(--pb-text); }

/* ── MANAGE LIST (cats/cols) ── */
.pb-manage-list { display: flex; flex-direction: column; gap: 8px; }
.pb-manage-item { display: flex; align-items: center; gap: 9px; background: #f7f6f3; border-radius: 10px; padding: 9px 11px; }
.pb-manage-item-label { flex: 1; font-size: 13px; font-weight: 600; }
.pb-color-input { width: 36px; height: 36px; border: 1.5px solid var(--pb-border); border-radius: 8px; cursor: pointer; padding: 2px; background: none; }
.pb-manage-add-row { display: flex; gap: 8px; margin-top: 4px; }

/* ── TOAST ── */
.pb-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(8px); background: var(--pb-text); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 13px; font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; z-index: 999; white-space: nowrap; }
.pb-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── RESPONSIVE ── */
@media (min-width: 769px) { .pb-col-accordion { display: none; } }
@media (max-width: 768px) {
  .pb-board-scroll { display: none; }
  .pb-view-toggle  { display: none; }
  .pb-board-mobile-wrap { padding: 12px 12px 48px; }
}
@media (min-width: 769px) { .pb-board-mobile-wrap { display: none; } }
@media (max-width: 500px) {
  .pb-topbar { padding: 9px 12px; }
  .pb-brand  { font-size: 16px; }
  .pb-form-row { grid-template-columns: 1fr; }
}
