/* DayBrief — cỏ xanh + 4 màu Google, mỗi section một tông, không viền */
:root {
  --g-blue: #4285f4;
  --g-red: #ea4335;
  --g-yellow: #fbbc05;
  --g-green: #34a853;
  --g-blue-ink: #131722;
  --g-red-ink: #131722;
  --g-yellow-ink: #131722;
  --g-green-ink: #131722;

  --g-blue-soft: transparent;
  --g-red-soft: transparent;
  --g-yellow-soft: transparent;
  --g-green-soft: transparent;

  --bg: #c8e6ef;
  --bg-card: transparent;
  --panel: transparent;
  --panel-inner: rgba(255, 255, 255, 0.28);
  --panel-line: rgba(255, 255, 255, 0.22);
  --panel-line-soft: rgba(19, 23, 34, 0.08);
  --text: #131722;
  --text-secondary: #434651;
  --text-muted: #787b86;
  --on-photo: #ffffff;

  --accent: var(--g-green);
  --live: var(--g-green);
  --live-ring: rgba(52, 168, 83, 0.8);
  --rain: var(--g-blue);

  --radius: 14px;
  --radius-sm: 8px;
  --shadow-card: 0 1px 2px rgba(32, 33, 36, 0.06), 0 4px 16px rgba(32, 33, 36, 0.06);
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

::selection,
::-moz-selection {
  background: rgba(66, 133, 244, 0.45);
  color: #131722;
  text-shadow: none;
}

[hidden] {
  display: none !important;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-size: cover;
  background-position: left center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.header,
.page,
.footer,
.edit-bar,
.empty-dashboard {
  position: relative;
  z-index: 1;
}

/* ─── Header ─── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.75rem 0.85rem;
  max-width: 1100px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  margin-left: -11px;
}

.brand-mark svg {
  width: 56px;
  height: 56px;
  display: block;
}

.brand h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.038em;
  color: #fff;
  line-height: 1.15;
}

.brand h1 span {
  font-weight: 650;
  color: #fff;
}

.tagline {
  margin: 0.12rem 0 0;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.88);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  background: var(--panel-inner);
  border: 1px solid var(--panel-line-soft);
  font-family: var(--mono);
  font-size: 0.73rem;
  color: var(--text);
  font-weight: 550;
}

.meta-sep {
  color: var(--text-muted);
}

#clock-date {
  text-transform: capitalize;
  color: var(--text);
  font-weight: 600;
}

#clock-time {
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 3px var(--live-ring);
  flex-shrink: 0;
}

/* ─── Page ─── */
.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.5rem 1.75rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.65rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 0;
  position: relative;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.8rem 0.8rem 0.2rem;
  border: none;
  background: transparent;
}

.panel-head h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--on-photo);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.panel-sub {
  margin: 0.05rem 0 0;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.92);
  font-weight: 550;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.external-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--on-photo);
  font-size: 0.73rem;
  font-weight: 700;
  text-decoration: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
}

.external-link:hover,
.todo-open:hover {
  text-decoration: underline;
}

.external-link:focus-visible,
.todo-open:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

/* ─── Web hay xem — xanh Google ─── */
.todo-panel .panel-head-inline h2 {
  color: var(--on-photo);
}

.panel-head-inline {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.6rem;
  padding: 0.8rem 0.8rem 0.9rem;
  border: none;
  background: transparent;
}

.panel-head-inline h2 {
  flex-shrink: 0;
  font-size: 0.9rem;
  white-space: nowrap;
}

.links-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.todo-bar {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: 0.5rem;
  width: 100%;
}

body.is-editing .todo-chip {
  padding-right: 2rem;
}

.todo-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--panel-line-soft);
  background: var(--panel-inner);
  min-width: 0;
  position: relative;
}

.todo-chip-label,
.todo-open {
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.todo-chip-label {
  font-size: 0.84rem;
  font-weight: 700;
  color: #131722;
  letter-spacing: -0.01em;
}

.todo-chip-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  width: 100%;
  min-width: 0;
}

.todo-open {
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  font-family: var(--mono);
  color: #fff;
  text-decoration: none;
  background: transparent;
  border: none;
}

/* ─── Thời tiết — xanh dương Google ─── */
.weather-panel .panel-head h2,
.now-temp {
  color: var(--on-photo);
}

.weather-now {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 0.8rem 0.5rem;
}

.now-main {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.now-icon {
  font-size: 2.8rem;
  line-height: 1;
  display: inline-block;
}

.now-temp-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.now-temp {
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}

.now-feels {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 550;
}

.now-desc {
  margin: 0.15rem 0 0;
  font-size: 0.88rem;
  color: var(--on-photo);
  font-weight: 600;
}

.now-stats {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  padding: 0.55rem 0.95rem;
  border-radius: 10px;
  background: var(--panel-inner);
  border: 1px solid var(--panel-line-soft);
}

.now-stat {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 4rem;
}

.now-stat-label {
  font-size: 0.64rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.now-stat-value {
  font-size: 0.9rem;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--text);
}

.weather-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
  padding: 0.75rem 0.8rem 1.15rem;
}

.weather-loading,
.weather-error {
  grid-column: 1 / -1;
  padding: 1.25rem 0.5rem;
  text-align: center;
  color: var(--on-photo);
  font-size: 0.85rem;
  font-weight: 600;
}

.weather-error {
  color: #f23645;
}

.weather-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.65rem 0.3rem;
  border-radius: 10px;
  background: var(--panel-inner);
  border: 1px solid var(--panel-line-soft);
  min-width: 0;
  text-align: center;
}

.weather-day.is-today {
  background: rgba(255, 255, 255, 0.38);
  border-color: rgba(19, 23, 34, 0.18);
}

.weather-day .dow {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
}

.weather-day .date {
  font-family: var(--mono);
  font-size: 0.64rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.weather-day .icon {
  font-size: 1.65rem;
  line-height: 1.2;
  margin: 0.1rem 0;
  display: inline-block;
}

.weather-day .temps {
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.weather-day .temps .lo {
  color: var(--text-secondary);
  font-weight: 600;
}

.weather-day .desc {
  font-size: 0.64rem;
  color: var(--text-secondary);
  font-weight: 550;
  line-height: 1.25;
  max-width: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.weather-day .rain {
  margin-top: 0.05rem;
  font-size: 0.64rem;
  font-family: var(--mono);
  color: var(--g-blue-ink);
  font-weight: 700;
}

/* ─── Thị trường: vàng / đỏ / xanh dương ─── */
.markets-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.65rem;
}

.panel-gold,
.panel-oil,
.panel-crypto {
  background: transparent;
}

.panel-gold .panel-head h2,
.panel-oil .panel-head h2,
.panel-crypto .panel-head h2 {
  color: var(--on-photo);
}

.market-panel .panel-head {
  padding: 0.55rem 0.85rem 0.15rem;
}

.market-panel .panel-head h2 {
  font-size: 0.88rem;
  font-weight: 700;
}

.charts-grid {
  display: grid;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem 0.65rem;
}

.charts-grid-single {
  grid-template-columns: 1fr;
}

.charts-grid-crypto {
  grid-template-columns: repeat(4, 1fr);
}

.inner-grid {
  display: grid;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem 0.85rem;
}

.crypto-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.commodities-grid {
  grid-template-columns: 1fr 1fr;
}

.commodities-grid.is-single {
  grid-template-columns: 1fr;
}

.item-card {
  position: relative;
  min-width: 0;
}

.item-card-head {
  padding: 0.15rem 0.15rem 0.2rem;
}

.item-card-head h3 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--on-photo);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.section-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 0.85rem 0.4rem 0.5rem;
  text-align: center;
  color: var(--on-photo);
  font-size: 0.82rem;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.section-edit {
  display: none;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--panel-line-soft);
  background: var(--panel-inner);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.32rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  text-shadow: none;
}

.section-edit:hover {
  background: rgba(255, 255, 255, 0.4);
}

body.is-editing .section-edit {
  display: inline-flex;
}

.item-remove {
  display: none;
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  z-index: 3;
  appearance: none;
  border: none;
  background: var(--g-red);
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

body.is-editing .item-remove {
  display: grid;
  place-items: center;
}

.picker-group {
  list-style: none;
  margin: 0.55rem 0 0.15rem;
  padding: 0.15rem 0.15rem 0;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.widget-host {
  height: 150px;
  min-height: 150px;
  position: relative;
  background: var(--panel-inner);
  border-radius: 8px;
  overflow: hidden;
  border: none;
}

.widget-host .tradingview-widget-container,
.widget-host .tradingview-widget-container__widget {
  height: 100% !important;
  width: 100% !important;
}

.widget-host iframe {
  width: 100% !important;
  height: 100% !important;
  border: 0 !important;
}

.footer {
  text-align: center;
  padding: 0.8rem 1.5rem 2rem;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.74rem;
  font-weight: 550;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.footer p {
  margin: 0;
}

@media (max-width: 960px) {
  .crypto-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .weather-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .todo-bar {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .page {
    padding: 0.4rem 0.85rem 1.4rem;
    gap: 0.85rem;
  }

  .header {
    padding: 0.85rem 0.85rem 0.45rem;
    flex-wrap: wrap;
    gap: 0.6rem;
  }

  .header-right {
    width: 100%;
    justify-content: space-between;
  }

  .header-meta {
    border-radius: 999px;
  }

  .weather-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem;
  }

  .todo-bar {
    grid-template-columns: 1fr;
  }

  .commodities-grid {
    grid-template-columns: 1fr 1fr;
  }

  .widget-host {
    height: 140px;
    min-height: 140px;
  }

  .edit-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    margin-left: 0.85rem;
    margin-right: 0.85rem;
    width: calc(100% - 1.7rem);
    padding: 0.65rem 0.85rem;
  }

  .edit-bar-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  .edit-bar-actions {
    justify-content: flex-end;
  }
}

/* ─── Layout editor ─── */
.layout-btn {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  background: var(--panel-inner);
  border: 1px solid var(--panel-line-soft);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.73rem;
  font-weight: 700;
  line-height: 1.5;
  cursor: pointer;
  white-space: nowrap;
  text-shadow: none;
  flex-shrink: 0;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.layout-btn:hover {
  background: rgba(255, 255, 255, 0.45);
  text-decoration: none;
}

.layout-btn:active {
  transform: scale(0.97);
}

.edit-btn:hover {
  background: rgba(255, 255, 255, 0.42);
}

.layout-btn[aria-pressed="true"] {
  background: var(--g-green);
  border-color: transparent;
  color: #ffffff;
}

.layout-btn[aria-pressed="true"]:hover {
  background: var(--g-green);
  filter: brightness(1.05);
}

.layout-btn:focus-visible,
.edit-btn:focus-visible,
.box-handle:focus-visible,
.box-remove:focus-visible,
.box-size:focus-visible,
.picker-close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.edit-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  max-width: 1100px;
  margin: 0 auto 0.75rem;
  padding: 0.6rem 1.1rem;
  width: calc(100% - 3.5rem);
  border-radius: 14px;
  background: var(--panel-inner);
  border: 1px solid var(--panel-line-soft);
}

.edit-bar[hidden] {
  display: none !important;
}

.edit-bar-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.edit-bar-label {
  margin: 0;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.section-toggles {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.section-toggle-btn {
  appearance: none;
  border: 1px solid var(--panel-line-soft);
  background: rgba(255, 255, 255, 0.4);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.section-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.65);
  color: var(--text);
}

.section-toggle-btn.is-active {
  background: var(--g-green);
  border-color: transparent;
  color: #fff;
}

.section-toggle-btn.is-active:hover {
  filter: brightness(1.05);
}

.section-toggle-btn .toggle-indicator {
  font-weight: 800;
  font-size: 0.82rem;
}

.edit-hint {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
}

.edit-bar-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.edit-btn {
  appearance: none;
  border: 1px solid var(--panel-line-soft);
  background: rgba(255, 255, 255, 0.55);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.38rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
}

.edit-btn-primary {
  background: var(--g-green);
  border-color: transparent;
  color: #fff;
}

.edit-btn-primary:hover {
  filter: brightness(1.05);
  background: var(--g-green);
}

.empty-dashboard {
  max-width: 1100px;
  margin: 0 auto 2rem;
  padding: 1.6rem 1.2rem;
  width: calc(100% - 3.5rem);
  text-align: center;
  border-radius: var(--radius);
  background: var(--panel-inner);
  border: 1px dashed rgba(19, 23, 34, 0.22);
}

.empty-dashboard p {
  margin: 0 0 0.8rem;
  font-weight: 650;
  color: var(--on-photo);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

body.is-editing .box {
  outline: 1.5px dashed rgba(255, 255, 255, 0.55);
  outline-offset: 2px;
  cursor: grab;
}

body.is-editing .box:active {
  cursor: grabbing;
}

body.is-editing .panel-head {
  padding-right: 7rem;
}

body.is-editing .item-card {
  outline: 1px dashed rgba(255, 255, 255, 0.35);
  outline-offset: 1px;
  border-radius: 10px;
  cursor: default;
}

body.is-editing .item-card-head {
  padding-right: 1.8rem;
}

body.is-editing .empty-dashboard {
  display: block;
}

body.is-editing .widget-host,
body.is-editing .todo-open,
body.is-editing .external-link {
  pointer-events: none;
}

body.is-editing .weather-panel .external-link {
  opacity: 0;
}

.box-toolbar {
  display: none;
  position: absolute;
  top: 0.55rem;
  right: 0.75rem;
  z-index: 5;
  gap: 0.32rem;
  align-items: center;
}

body.is-editing .box-toolbar {
  display: flex;
}

body.is-editing .box,
body.is-editing .box-toolbar {
  touch-action: none;
}

.box-handle,
.box-remove,
.box-size,
.box-move {
  appearance: none;
  border: 1px solid var(--panel-line-soft);
  background: rgba(255, 255, 255, 0.85);
  color: var(--text);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  font: inherit;
  line-height: 1;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  transition: background 0.15s ease, transform 0.1s ease;
}

.box-handle {
  cursor: grab;
  touch-action: none;
  width: 36px;
  height: 36px;
}

.box-move {
  display: inline-flex;
  font-size: 0.92rem;
  font-weight: 800;
  touch-action: manipulation;
}

.box-move:hover {
  background: #ffffff;
}

.box-move:active {
  transform: scale(0.92);
}

.box-move:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.box-handle svg {
  width: 14px;
  height: 14px;
  display: block;
}

body.is-dragging .box-handle {
  cursor: grabbing;
}

.box-remove {
  color: #fff;
  background: var(--g-red);
  border-color: transparent;
  font-size: 1.05rem;
  font-weight: 700;
}

.box-remove:hover {
  filter: brightness(1.1);
  background: var(--g-red);
}

.box-remove:active {
  transform: scale(0.92);
}

.box-size {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  width: auto;
  min-width: 28px;
  padding: 0 0.35rem;
  font-family: var(--mono);
}

.box.is-drag-source {
  opacity: 0.45;
}

.box.drop-target {
  outline: 2.5px solid var(--g-green) !important;
  outline-offset: 4px;
}

.box.drop-target {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.add-box-tile {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  border-radius: var(--radius);
  border: 1.5px dashed rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.12);
  color: var(--on-photo);
  font-family: var(--font);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  grid-column: span 2;
  order: 1000;
}

body.is-editing .add-box-tile {
  display: flex;
}

.add-box-tile:hover {
  background: rgba(255, 255, 255, 0.22);
}

.box-picker {
  border: none;
  border-radius: 16px;
  padding: 0;
  width: min(440px, calc(100vw - 1.5rem));
  background: #f4f7fb;
  color: var(--text);
  box-shadow: 0 16px 50px rgba(19, 23, 34, 0.28);
}

.box-picker::backdrop {
  background: rgba(19, 23, 34, 0.45);
}

.box-picker-inner {
  padding: 1.05rem 1.1rem 1.15rem;
}

.box-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.box-picker-head h3 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.picker-close {
  appearance: none;
  border: none;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.picker-close:hover {
  background: rgba(19, 23, 34, 0.08);
}

.picker-sub,
.picker-hint {
  margin: 0.35rem 0 0.8rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.picker-hint {
  margin: 0.35rem 0 0.7rem;
}

.picker-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
  max-height: 42vh;
  overflow: auto;
}

.picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  width: 100%;
  text-align: left;
  appearance: none;
  border: 1px solid rgba(19, 23, 34, 0.1);
  background: #fff;
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  font-family: var(--font);
  color: var(--text);
}

.picker-item:hover {
  border-color: rgba(19, 23, 34, 0.22);
}

.picker-item-title {
  font-size: 0.86rem;
  font-weight: 700;
}

.picker-item-meta {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--mono);
  font-weight: 550;
}

.picker-item-state {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(19, 23, 34, 0.08);
  color: var(--text-secondary);
}

.picker-item.is-on .picker-item-state {
  background: rgba(52, 168, 83, 0.16);
  color: #1e7a38;
}

.custom-chart-form {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(19, 23, 34, 0.1);
}

.custom-chart-form h4 {
  margin: 0 0 0.55rem;
  font-size: 0.86rem;
}

.custom-chart-fields {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 0.5rem;
}

.custom-chart-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.custom-chart-form input {
  appearance: none;
  border: 1px solid rgba(19, 23, 34, 0.14);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text);
  background: #fff;
}

.custom-chart-form input:focus {
  outline: 2px solid var(--g-blue);
  outline-offset: 1px;
}

body.is-dragging {
  user-select: none;
  cursor: grabbing;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
}

body.is-dragging iframe {
  pointer-events: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.35rem;
  z-index: 40;
  transform: translateX(-50%) translateY(10px);
  padding: 0.55rem 1.05rem;
  border-radius: 999px;
  background: rgba(19, 23, 34, 0.9);
  color: #fff;
  font-family: var(--font);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: calc(100vw - 2rem);
  text-align: center;
}

.toast.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 560px) {
  .custom-chart-fields {
    grid-template-columns: 1fr;
  }

  body.is-editing .item-remove {
    width: 32px;
    height: 32px;
  }
}

