/* ==========================================================================
   Fikoraa — app shell (couple, vendor and admin workspaces)
   ========================================================================== */

body.app-body { background: #F4F0E7; }

.app-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: calc(100vh - 72px); }
.app-sidebar {
  background: var(--surface); border-right: 1px solid var(--line);
  padding: var(--sp-5) var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-5);
  position: sticky; top: calc(72px + env(safe-area-inset-top, 0px)); height: calc(100vh - 72px); overflow-y: auto;
}
.app-sidebar .ws-label { font-size: var(--fs-xs); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 0 var(--sp-3); }
.app-sidebar .wedding-chip { padding: var(--sp-3); border-radius: var(--r-md); background: var(--sage); display: grid; gap: 2px; }
.app-sidebar .wedding-chip strong { font-family: var(--font-display); font-size: 1.3rem; color: var(--forest); line-height: 1.15; }
.side-nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem var(--sp-3); border-radius: var(--r-sm);
  text-decoration: none; color: var(--charcoal); font-size: var(--fs-sm); font-weight: 500; min-height: 42px;
}
.side-nav a svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.side-nav a:hover { background: #F4F0E7; color: var(--forest); }
.side-nav a[aria-current="page"] { background: var(--forest); color: var(--on-accent); }
.side-nav a[aria-current="page"] svg { color: var(--gold-light); }
.side-foot { margin-top: auto; display: grid; gap: var(--sp-3); font-size: var(--fs-xs); color: var(--muted); }

.app-main { padding: clamp(1rem, 3vw, 2.25rem) var(--gutter) var(--sp-8); display: flex; flex-direction: column; gap: var(--sp-5); min-width: 0; }
.app-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); }
.app-head > div:first-child { display: grid; gap: var(--sp-2); min-width: 0; }
.app-head h1 { font-size: var(--fs-2xl); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.panel-head h2 { font-size: var(--fs-lg); font-weight: 600; }
.panel-head h2.sans { font-family: var(--font-body); font-size: var(--fs-md); }

.dash-grid { display: grid; gap: var(--sp-5); grid-template-columns: repeat(12, minmax(0, 1fr)); }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; }
.span-6 { grid-column: span 6; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; }

.stats { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-4); display: grid; gap: 0.2rem; }
.stat .k { font-size: var(--fs-xs); color: var(--muted); font-weight: 500; }
.stat .v { font-family: var(--font-display); font-size: 2.1rem; line-height: 1.05; color: var(--forest); font-variant-numeric: tabular-nums; }
.stat .s { font-size: var(--fs-xs); color: var(--muted); }
.stat.warn { border-color: #E9D2A8; background: #FFFAF0; }

.countdown-hero {
  position: relative; overflow: hidden; border-radius: var(--r-lg); background: var(--forest); color: #E8EDE6;
  padding: var(--sp-6); display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sp-5); align-items: center;
}
.countdown-hero::before { content: ""; position: absolute; inset: 0; color: rgba(226, 204, 152, 0.1);
  background-image: linear-gradient(45deg, transparent 48.5%, currentColor 48.5% 51.5%, transparent 51.5%), linear-gradient(-45deg, transparent 48.5%, currentColor 48.5% 51.5%, transparent 51.5%);
  background-size: 52px 52px; }
.countdown-hero > * { position: relative; }
.countdown-hero h2 { color: var(--warm-white); font-size: var(--fs-xl); }
.countdown { display: flex; gap: var(--sp-4); }
.countdown div { display: grid; text-align: center; min-width: 58px; }
.countdown b { font-family: var(--font-display); font-weight: 500; font-size: 2.6rem; line-height: 1; color: var(--warm-white); font-variant-numeric: tabular-nums; }
.countdown span { font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-light); }

.list { list-style: none; margin: 0; padding: 0; display: grid; }
.list > li { display: flex; gap: var(--sp-3); align-items: center; padding: 0.75rem 0; border-bottom: 1px solid var(--line); min-width: 0; }
.list > li:last-child { border-bottom: 0; }
.list > li.muted { display: block; }
.list .grow { flex: 1; min-width: 0; display: grid; gap: 2px; }
.list .grow strong { font-weight: 600; font-size: var(--fs-sm); overflow-wrap: anywhere; }

.date-tile { width: 52px; flex: none; border-radius: var(--r-sm); border: 1px solid var(--line-strong); text-align: center; overflow: hidden; }
.date-tile span { display: block; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em; background: var(--forest); color: var(--gold-light); padding: 2px 0; }
.date-tile b { display: block; font-family: var(--font-display); font-size: 1.5rem; color: var(--forest); line-height: 1.3; }

.toolbar { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr)); gap: var(--sp-3); align-items: end; }
.toolbar .field.wide { grid-column: span 2; }
.toolbar > .btn, .toolbar > .small { justify-self: start; }
@media (max-width: 640px) { .toolbar .field.wide { grid-column: auto; } }
.bulk-bar { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; padding: var(--sp-3) var(--sp-4); background: var(--sage); border-radius: var(--r-md); font-size: var(--fs-sm); }

/* Task rows */
.task { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.task + .task { margin-top: var(--sp-2); }
.task input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--forest); margin-top: 2px; flex: none; }
.task .grow { flex: 1; min-width: 0; display: grid; gap: 0.35rem; }
.task.done .t-title { text-decoration: line-through; color: var(--muted); }
.task.overdue { border-color: #EBC6C0; background: #FFFBFA; }
.prio { width: 4px; align-self: stretch; border-radius: 2px; flex: none; }
.prio.high { background: var(--danger); } .prio.medium { background: var(--gold); } .prio.low { background: #9DB3A2; }

/* Budget bars */
.bar-row { display: grid; grid-template-columns: minmax(7rem, 12rem) minmax(0, 1fr) auto; gap: var(--sp-3); align-items: center; font-size: var(--fs-sm); }
.bar-track { height: 12px; background: var(--sage); border-radius: 6px; overflow: hidden; position: relative; }
.bar-track .est { position: absolute; inset: 0 auto 0 0; background: var(--gold-soft); }
.bar-track .act { position: absolute; inset: 3px auto 3px 0; background: var(--forest); border-radius: 0 3px 3px 0; }
.legend { display: flex; gap: var(--sp-4); flex-wrap: wrap; font-size: var(--fs-xs); color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -2px; }

/* Editor */
.editor-layout { display: grid; grid-template-columns: minmax(320px, 420px) minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
.editor-panel { position: sticky; top: calc(88px + env(safe-area-inset-top, 0px)); max-height: calc(100vh - 104px); overflow-y: auto; }
.editor-panel .tabs { position: sticky; top: calc(-1 * var(--sp-5)); background: var(--surface); z-index: 2; margin: calc(-1 * var(--sp-5)) calc(-1 * var(--sp-5)) 0; padding: var(--sp-3) var(--sp-4) 0; }
.section-order { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
.section-order li { display: flex; align-items: center; gap: var(--sp-2); padding: 0.4rem 0.6rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--warm-white); font-size: var(--fs-sm); }
.section-order li .grow { flex: 1; }
.section-order li.off { opacity: 0.55; }
.swatch-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.swatch-btn { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line); padding: 0; display: grid; place-items: center; overflow: hidden; }
.swatch-btn[aria-pressed="true"] { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(48, 70, 56, 0.2); }
.swatch-btn span { width: 100%; height: 100%; display: block; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: var(--sp-2); }
.photo-grid figure { margin: 0; position: relative; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; background: var(--sage); }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; }
.photo-grid button { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 14px; line-height: 1; }
.dropzone { border: 1.5px dashed var(--line-strong); border-radius: var(--r-md); padding: var(--sp-5); text-align: center; display: grid; gap: var(--sp-2); justify-items: center; color: var(--muted); font-size: var(--fs-sm); }
.dropzone.drag { border-color: var(--forest); background: var(--sage); }
.repeat-item { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-3); display: grid; gap: var(--sp-3); background: var(--warm-white); }

/* Admin */
.admin-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
.admin-tabs { display: grid; gap: 2px; position: sticky; top: calc(88px + env(safe-area-inset-top, 0px)); }
.admin-tabs [role="tab"] { text-align: left; background: none; border: 0; border-radius: var(--r-sm); padding: 0.55rem 0.8rem; font-size: var(--fs-sm); color: var(--charcoal); min-height: 40px; }
.admin-tabs [role="tab"][aria-selected="true"] { background: var(--forest); color: var(--on-accent); font-weight: 600; }
.admin-tabs [role="tab"]:hover:not([aria-selected="true"]) { background: #EFEAE0; }
.countdown-hero .eyebrow { color: var(--gold-light); }

.editor-panel .tabs { flex-wrap: nowrap; overflow-x: auto; gap: 0; }
.editor-panel .tabs [role="tab"] { padding-inline: 0.7rem; white-space: nowrap; }

/* Admin uses its own section list, so it gets the full width */
body[data-layout="admin"] .app-layout { grid-template-columns: minmax(0, 1fr); }
body[data-layout="admin"] .app-sidebar { display: none; }
