/* Tamas Tanya pitch kit - mobile first back office layer (needs tokens.css) */

body.admin { background: var(--pale); font-size: var(--fs-sm); }

/* shell */
.app { min-height: 100vh; padding-bottom: 78px; }
.app-top {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: var(--s3);
  height: 58px; padding: 0 var(--s4);
  background: var(--forest-dark); color: var(--cream);
}
.app-top .app-title { font-family: var(--font-head); font-size: var(--fs-lg); font-weight: 600; }
.prop-switch {
  display: flex; gap: 2px; padding: 2px; border-radius: var(--radius-pill);
  background: rgba(253, 252, 249, .12);
}
.prop-switch button {
  border: 0; background: none; color: #d8d3c6; cursor: pointer;
  padding: 5px 12px; border-radius: var(--radius-pill);
  font-size: var(--fs-xs); font-weight: 700; white-space: nowrap;
}
.prop-switch button.is-active { background: var(--gold); color: var(--forest-dark); }
.app-avatar {
  margin-left: auto; width: 32px; height: 32px; border-radius: 50%;
  background: var(--gold); color: var(--forest-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: var(--fs-xs); flex: 0 0 auto;
}
.app-main { padding: var(--s4); width: 100%; max-width: 1180px; margin: 0 auto; min-width: 0; }
.app-main > h2 { font-size: var(--fs-xl); }

/* bottom tab bar under 1024, sidebar above */
.app-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; }
.tabbar {
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--white); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tabbar a, .tabbar button {
  border: 0; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 2px; font-size: 10px; font-weight: 700; color: var(--muted);
  text-align: center;
}
.tabbar .tab-icon { font-family: var(--font-head); font-size: var(--fs-md); line-height: 1; }
.tabbar a.is-active { color: var(--forest); }
.tabbar a.is-active .tab-icon { color: var(--gold); }
.sidebar { display: none; }
.more-sheet {
  position: fixed; inset: auto 0 0 0; z-index: 60;
  background: var(--white); border-top: 1px solid var(--line);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--s5) var(--s4) 84px;
  box-shadow: var(--shadow-lg);
}
.more-sheet:not(.is-open) { display: none; }
.more-sheet a { display: block; padding: 11px 4px; border-bottom: 1px solid var(--line); font-weight: 700; }

@media (min-width: 1024px) {
  .app { display: grid; grid-template-columns: 244px minmax(0, 1fr); grid-template-rows: 58px 1fr; padding-bottom: 0; }
  .app-top { grid-column: 1 / -1; padding: 0 var(--s5); gap: var(--s5); }
  .app-nav { position: sticky; top: 58px; left: auto; right: auto; bottom: auto; height: calc(100vh - 58px); }
  .sidebar {
    display: block; height: 100%; overflow-y: auto;
    background: var(--white); border-right: 1px solid var(--line); padding: var(--s4) var(--s3);
  }
  .sidebar a {
    display: flex; align-items: center; gap: var(--s3);
    padding: 9px var(--s3); border-radius: var(--radius);
    font-size: var(--fs-sm); font-weight: 700; color: var(--ink);
  }
  .sidebar a:hover { background: var(--pale); }
  .sidebar a.is-active { background: var(--forest); color: var(--cream); }
  .sidebar .nav-group {
    font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
    color: var(--muted-soft); padding: var(--s4) var(--s3) var(--s2);
  }
  .tabbar, .more-sheet { display: none; }
  .app-main { padding: var(--s6); }
}

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s3); }
@media (min-width: 780px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4); }
.kpi .kpi-label { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.kpi .kpi-value { font-family: var(--font-head); font-size: var(--fs-2xl); line-height: 1.1; color: var(--forest-dark); }
.kpi .kpi-delta { font-size: var(--fs-xs); font-weight: 700; color: var(--success); }
.kpi .kpi-delta.down { color: var(--danger); }

/* list rows */
.rows { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row-item {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s4); border-bottom: 1px solid var(--line);
  width: 100%; text-align: left; background: none; border-left: 0; border-right: 0; border-top: 0; cursor: pointer;
}
.row-item:last-child { border-bottom: 0; }
.row-item:hover { background: #faf9f5; }
.row-main { flex: 1 1 auto; min-width: 0; }
.row-title { display: block; font-weight: 700; color: var(--forest-dark); }
.row-sub { display: block; font-size: var(--fs-xs); color: var(--muted); }
.row-chevron { color: var(--muted-soft); flex: 0 0 auto; font-size: var(--fs-md); }

/* calendar */
.cal { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s3); }
.cal-head .cal-month { font-family: var(--font-head); font-size: var(--fs-lg); color: var(--forest-dark); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-dow { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-soft); text-align: center; padding-bottom: 4px; }
.cal-day {
  aspect-ratio: 1 / 1;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius); border: 1px solid var(--line);
  font-size: var(--fs-xs); font-weight: 700; background: var(--white); color: var(--ink);
  cursor: pointer;
}
.cal-day.is-out { opacity: .3; }
.cal-day.d-free { background: var(--white); }
.cal-day.d-wedding { background: var(--forest); border-color: var(--forest); color: var(--cream); }
.cal-day.d-hold { background: var(--warn-bg); border-color: #e3cea0; color: var(--warn); }
.cal-day.d-released { background: var(--info-bg); border-color: #bcd0dd; color: var(--info); }
.cal-day.d-event { background: var(--success-bg); border-color: #bcd8c2; color: var(--success); }
.cal-day.d-closed { background: #ece9e2; border-color: var(--line); color: var(--muted-soft); text-decoration: line-through; }
.cal-legend { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); margin-top: var(--s4); font-size: var(--fs-xs); color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend i { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--line); display: inline-block; }
@media (max-width: 420px) { .cal { padding: var(--s3); } .cal-day { font-size: 11px; } }
@media (min-width: 720px) { .cal-grid { max-width: 520px; } .cal-day { aspect-ratio: auto; height: 62px; } }

/* pipeline */
.pipeline { display: flex; gap: var(--s3); overflow-x: auto; padding-bottom: var(--s3); }
@media (max-width: 1023px) {
  .pipeline::after {
    content: ""; flex: 0 0 0; position: sticky; right: 0; align-self: stretch;
    width: 28px; margin-left: -28px; pointer-events: none;
    background: linear-gradient(to right, transparent, var(--pale));
  }
}
.pipe-col { flex: 0 0 240px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s3); }
.pipe-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700;
  margin-bottom: var(--s3);
}
.pipe-card {
  background: var(--pale); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--s3); margin-bottom: var(--s2); cursor: pointer;
}
.pipe-card:hover { border-color: var(--gold); }
.pipe-card .pc-title { font-weight: 700; font-size: var(--fs-sm); color: var(--forest-dark); }
.pipe-card .pc-meta { font-size: var(--fs-xs); color: var(--muted); }
@media (min-width: 1024px) { .pipe-col { flex: 1 1 0; min-width: 200px; } }

/* detail panel */
.detail {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.detail-head { padding: var(--s5); border-bottom: 1px solid var(--line); background: var(--pale); }
.detail-body { padding: var(--s5); }
.detail-list { list-style: none; padding: 0; margin: 0; }
.detail-list li { display: flex; justify-content: space-between; gap: var(--s4); padding: 9px 0; border-bottom: 1px dashed var(--line); }
.detail-list li:last-child { border-bottom: 0; }
.detail-list .dl-key { color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; }
.detail-foot { padding: var(--s4) var(--s5); border-top: 1px solid var(--line); display: flex; gap: var(--s3); flex-wrap: wrap; }

/* toggle */
.toggle { display: flex; align-items: center; gap: var(--s3); cursor: pointer; padding: var(--s3) 0; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle .track {
  width: 44px; height: 26px; border-radius: var(--radius-pill);
  background: var(--line); position: relative; transition: background .18s ease; flex: 0 0 auto;
}
.toggle .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--white); box-shadow: var(--shadow-sm); transition: transform .18s ease;
}
.toggle input:checked + .track { background: var(--forest); }
.toggle input:checked + .track::after { transform: translateX(18px); }

/* tabs */
.tabs { display: flex; gap: var(--s4); border-bottom: 1px solid var(--line); margin-bottom: var(--s5); overflow-x: auto; }
@media (max-width: 1023px) {
  .tabs::after {
    content: ""; flex: 0 0 0; position: sticky; right: 0; align-self: stretch;
    width: 24px; margin-left: -24px; pointer-events: none;
    background: linear-gradient(to right, transparent, var(--pale));
  }
}
.tabs button {
  border: 0; background: none; cursor: pointer; white-space: nowrap;
  padding: var(--s3) 2px; font-size: var(--fs-sm); font-weight: 700; color: var(--muted);
  border-bottom: 2px solid transparent;
}
.tabs button.is-active { color: var(--forest-dark); border-bottom-color: var(--gold); }

.field > label.btn { display: inline-flex; }

/* toast */
.toast {
  display: flex; align-items: center; gap: var(--s3);
  background: var(--forest-dark); color: var(--cream);
  padding: var(--s3) var(--s5); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); font-size: var(--fs-sm); font-weight: 700;
}
.toast.toast-ok { background: var(--success); }
.toast.toast-warn { background: var(--warn); }

/* editor with live preview */
.editor-split { display: grid; grid-template-columns: 1fr; gap: var(--s4); }
@media (min-width: 1024px) { .editor-split { grid-template-columns: 1fr 1fr; gap: var(--s5); } }
.editor-pane, .preview-pane {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4);
}
.preview-pane { background: var(--pale); }
.pane-label {
  font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 700;
  margin-bottom: var(--s3);
}

/* CSS bar chart */
.bars { display: flex; align-items: flex-end; gap: var(--s2); height: 150px; padding-top: var(--s4); }
.bars .bar { flex: 1 1 0; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; text-align: center; }
.bars .bar i { display: block; background: var(--forest); border-radius: 3px 3px 0 0; }
.bars .bar.hi i { background: var(--gold); }
.bars .bar b { font-size: 10px; color: var(--muted); font-weight: 700; padding-top: 5px; }
.bars .bar em { font-size: 10px; color: var(--muted-soft); font-style: normal; }

/* empty state */
.empty { text-align: center; padding: var(--s8) var(--s5); color: var(--muted); }
.empty .empty-mark { font-family: var(--font-head); font-size: var(--fs-3xl); color: var(--line); line-height: 1; }
.empty h3 { font-size: var(--fs-lg); margin: var(--s3) 0 var(--s2); }
.empty p { font-size: var(--fs-sm); margin: 0 auto var(--s4); max-width: 44ch; }
