:root {
  --bg: #fafafa;
  --panel: #ffffff;
  --text: #171717;
  --muted: #77736f;
  --line: #eceae7;
  --accent: #ff5b35;
  --accent-soft: #fff0eb;
  --danger: #ed1c24;
  --green: #176b4a;
  --green-soft: #edf8f2;
  --shadow: 0 24px 70px rgba(25, 23, 20, 0.08);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-height: 100vh; }
button, input { font: inherit; }
button { cursor: pointer; }

.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(250,250,250,.92);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 750; letter-spacing: -0.02em; }
.brand-mark { width: 30px; height: 30px; border-radius: 10px; background: #171717; position: relative; }
.brand-mark::after { content: ""; position: absolute; width: 13px; height: 9px; border-radius: 999px; background: var(--accent); left: 8px; top: 11px; transform: rotate(-20deg); }
.brand-sub { color: var(--muted); font-size: 12px; font-weight: 500; }

.page { flex: 1; padding: 34px 28px 50px; }
.center-page { display: grid; place-items: center; }
.card { width: min(520px, 100%); padding: 34px; background: var(--panel); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow); }
.eyebrow { color: var(--accent); font-size: 13px; font-weight: 750; margin-bottom: 12px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(32px, 5vw, 52px); line-height: 1.08; letter-spacing: -0.045em; margin-bottom: 14px; }
h2 { font-size: 24px; letter-spacing: -0.03em; }
.lead { color: var(--muted); line-height: 1.85; margin-bottom: 28px; }

.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field label { font-size: 13px; font-weight: 700; }
.input {
  width: 100%; height: 52px; border-radius: 15px; border: 1px solid var(--line);
  background: #fff; padding: 0 16px; outline: none; transition: .18s ease;
}
.input:focus { border-color: #aaa49e; box-shadow: 0 0 0 4px rgba(20,20,20,.05); }
.segmented { display: flex; gap: 8px; flex-wrap: wrap; }
.segment {
  min-width: 72px; height: 44px; padding: 0 16px; border-radius: 13px;
  border: 1px solid var(--line); background: #fff; color: var(--muted); font-weight: 700;
}
.segment.active { background: #171717; color: #fff; border-color: #171717; }
.primary, .secondary, .ghost {
  border: 0; border-radius: 14px; height: 48px; padding: 0 20px; font-weight: 750;
}
.primary { background: #171717; color: #fff; }
.primary:hover { background: #292929; }
.primary:disabled { opacity: .45; cursor: not-allowed; }
.secondary { background: var(--accent-soft); color: #a93216; }
.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.full { width: 100%; }

.success-links { display: grid; gap: 12px; margin: 22px 0; }
.link-box { display: flex; direction: ltr; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; background: #f7f6f4; border-radius: 15px; border: 1px solid var(--line); }
.link-box code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; font-size: 12px; color: #4d4945; }
.copy-mini { border: 0; height: 34px; padding: 0 12px; border-radius: 10px; background: #fff; box-shadow: 0 1px 0 rgba(0,0,0,.04); font-weight: 700; }

.meet-page { padding: 0 0 34px; }
.meet-head { padding: 22px 28px 18px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.meet-title h1 { font-size: clamp(25px, 4vw, 42px); margin: 0 0 7px; }
.meet-title p { margin: 0; color: var(--muted); font-size: 14px; }
.actions { display: flex; gap: 9px; flex-wrap: wrap; }

.name-strip { display: flex; gap: 10px; align-items: center; padding: 0 28px 18px; }
.name-strip .input { max-width: 340px; }
.name-strip .primary { min-width: 115px; }

.schedule-note { margin: 0 28px 20px; background: var(--green-soft); border: 1px solid #dbeee4; border-radius: 17px; padding: 15px 17px; }
.schedule-note strong { color: var(--green); }
.schedule-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.schedule-chip { background: #fff; border: 1px solid #dbeee4; border-radius: 999px; padding: 8px 12px; font-size: 13px; }

.grid-wrap { overflow: auto; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fff; scrollbar-width: thin; }
.availability-table { width: 100%; min-width: 920px; border-collapse: separate; border-spacing: 0; table-layout: fixed; direction: rtl; }
.availability-table th {
  height: 51px; background: #fbfbfa; border-bottom: 1px solid var(--line); font-size: 14px;
  position: sticky; top: 68px; z-index: 6;
}
.availability-table td { height: 54px; border-bottom: 1px solid var(--line); border-left: 1px solid #f4f2f0; padding: 0; position: relative; }
.availability-table tr:last-child td { border-bottom: 0; }
.slot {
  appearance: none; width: 100%; height: 100%; border: 0; background: transparent; color: #44413e;
  display: grid; place-items: center; position: relative; touch-action: none; user-select: none; font-variant-numeric: tabular-nums;
}
.slot:hover { background: #faf8f6; }
.slot.unavailable { background: rgba(237,28,36,.035); }
.slot.unavailable::after {
  content: ""; position: absolute; width: 14px; height: calc(100% + 2px); border-radius: 999px;
  background: var(--danger); left: 50%; top: -1px; transform: translateX(-50%); box-shadow: 0 0 0 1px rgba(255,255,255,.25);
}
.slot-time { position: relative; z-index: 2; font-size: 14px; }
.slot.unavailable .slot-time { opacity: .22; }

.result-cell { width: 100%; height: 100%; border: 0; display: grid; place-items: center; position: relative; background: rgba(23,107,74,var(--heat)); color: var(--result-text, #173f30); }
.result-cell .ratio { font-size: 13px; font-weight: 750; direction: ltr; }
.result-cell .time-small { font-size: 10px; opacity: .67; margin-top: 2px; direction: ltr; }
.result-cell.selected::after { content: ""; position: absolute; inset: 5px; border: 2px solid #171717; border-radius: 10px; }
.result-cell.best { box-shadow: inset 0 -3px 0 var(--accent); }

.grid-help { padding: 13px 28px; color: var(--muted); font-size: 13px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.legend { display: inline-flex; gap: 8px; align-items: center; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); }

.suggestions { padding: 24px 28px 0; }
.suggestions-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 13px; }
.suggestions-head h2 { margin: 0; }
.suggestion-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.suggestion {
  text-align: right; border: 1px solid var(--line); border-radius: 16px; background: #fff; padding: 15px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.suggestion.active { border-color: #171717; box-shadow: inset 0 0 0 1px #171717; }
.suggestion strong { display: block; margin-bottom: 4px; }
.suggestion small { color: var(--muted); }
.check { width: 22px; height: 22px; border: 1px solid #cbc7c2; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; }
.suggestion.active .check { background: #171717; color: #fff; border-color: #171717; }
.bottom-actions { padding: 18px 28px 0; display: flex; justify-content: flex-end; gap: 9px; }

.empty { margin: 55px auto; text-align: center; max-width: 410px; color: var(--muted); padding: 0 24px; }
.loader { min-height: 60vh; display: grid; place-items: center; color: var(--muted); }
.error-card { border-color: #ffd4c9; }
.toast { position: fixed; left: 50%; bottom: 25px; transform: translate(-50%, 20px); background: #171717; color: #fff; border-radius: 999px; padding: 11px 16px; font-size: 13px; opacity: 0; pointer-events: none; transition: .2s ease; z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 720px) {
  .topbar { height: 60px; padding: 0 16px; }
  .brand-sub { display: none; }
  .page { padding: 20px 16px 35px; }
  .card { padding: 24px 20px; border-radius: 20px; }
  .meet-head { padding: 18px 16px 14px; align-items: flex-start; flex-direction: column; }
  .name-strip { padding: 0 16px 14px; }
  .name-strip .input { max-width: none; }
  .grid-help, .suggestions, .bottom-actions { padding-right: 16px; padding-left: 16px; }
  .schedule-note { margin-right: 16px; margin-left: 16px; }
  .availability-table th { top: 60px; }
  .actions { width: 100%; }
  .actions button { flex: 1; }
  .grid-help { align-items: flex-start; flex-direction: column; }
}
