:root {
  --ink: #f5f2ea;
  --muted: #a9a9ad;
  --subtle: #71737a;
  --gold: #d5b36c;
  --gold-soft: rgba(213, 179, 108, .14);
  --panel: rgba(19, 21, 27, .84);
  --panel-solid: #12141a;
  --line: rgba(255, 255, 255, .11);
  --bg: #07080b;
  --green: #25d366;
  --danger: #c8776e;
  --radius: 26px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% -10%, rgba(213, 179, 108, .17), transparent 32rem),
    radial-gradient(circle at 95% 10%, rgba(67, 79, 113, .16), transparent 28rem),
    var(--bg);
  color: var(--ink);
  font-family: "Avenir Next", Avenir, "Trebuchet MS", sans-serif;
  line-height: 1.5;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid rgba(213, 179, 108, .55); outline-offset: 3px; }
[hidden] { display: none !important; }

.calendar-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid rgba(213, 179, 108, .18);
  background: rgba(7, 8, 11, .88);
  backdrop-filter: blur(18px);
}
.calendar-nav {
  width: min(1180px, calc(100% - 36px));
  min-height: 78px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.brand-logo img { width: 152px; display: block; }
.nav-back, .logout-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.045);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.calendar-main { width: min(1180px, calc(100% - 36px)); margin: 0 auto; padding: 72px 0 110px; }
.calendar-hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(250px, .8fr); align-items: end; gap: 40px; margin-bottom: 38px; }
.eyebrow { color: var(--gold); font-size: 12px; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
h1 { max-width: 760px; margin: 12px 0 18px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(48px, 7vw, 88px); line-height: .98; font-weight: 500; letter-spacing: -.055em; }
.calendar-hero p { max-width: 670px; margin: 0; color: var(--muted); font-size: clamp(16px, 2vw, 19px); }
.hero-note { border-left: 1px solid var(--gold); padding: 8px 0 8px 22px; color: #d8d5ce; font-size: 14px; }
.hero-note strong { display: block; margin-bottom: 5px; color: var(--ink); }

.calendar-shell, .dashboard-panel, .login-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(22, 24, 31, .94), rgba(13, 15, 20, .9));
  box-shadow: 0 35px 100px rgba(0,0,0,.3);
  overflow: hidden;
}
.calendar-toolbar { min-height: 88px; padding: 20px 24px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.calendar-toolbar h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(25px, 4vw, 34px); font-weight: 500; text-transform: capitalize; }
.month-controls { display: flex; gap: 8px; }
.month-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255,255,255,.04);
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}
.month-button:hover { transform: translateY(-2px); border-color: rgba(213,179,108,.5); background: var(--gold-soft); }
.weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekdays { padding: 0 14px; border-bottom: 1px solid var(--line); }
.weekdays span { padding: 15px 8px; color: var(--subtle); text-align: center; font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.calendar-grid { padding: 14px; gap: 8px; }
.day-cell {
  position: relative;
  min-height: 112px;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: rgba(255,255,255,.025);
  text-align: left;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.day-cell:hover { transform: translateY(-2px); border-color: rgba(255,255,255,.12); background: rgba(255,255,255,.045); }
.day-cell.is-outside { opacity: .25; pointer-events: none; }
.day-cell.is-today { border-color: rgba(213,179,108,.48); }
.day-cell.is-selected { border-color: var(--gold); box-shadow: inset 0 0 0 1px rgba(213,179,108,.25); }
.day-number { display: block; font-size: 15px; font-weight: 900; }
.day-state { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; align-items: center; gap: 7px; color: #8bc99c; font-size: 11px; font-weight: 850; }
.day-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.day-cell.is-busy { background: linear-gradient(145deg, rgba(213,179,108,.16), rgba(213,179,108,.055)); border-color: rgba(213,179,108,.27); }
.day-cell.is-busy .day-state { color: #e1c27e; }
.day-cell.is-loading { overflow: hidden; cursor: default; }
.day-cell.is-loading::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.06) 45%, transparent 70%); animation: shimmer 1.25s infinite; }

.calendar-detail { min-height: 126px; padding: 24px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.calendar-detail h3 { margin: 0 0 5px; font-size: 18px; }
.calendar-detail p { margin: 0; color: var(--muted); }
.time-list { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.time-chip { padding: 9px 12px; border: 1px solid rgba(213,179,108,.27); border-radius: 999px; background: var(--gold-soft); color: #ead29d; font-size: 13px; font-weight: 850; }
.legend { display: flex; align-items: center; gap: 20px; margin-top: 18px; color: var(--muted); font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; background: #8bc99c; }
.legend .busy-dot { background: var(--gold); }

.state-message { margin: 14px; padding: 22px; border: 1px solid rgba(200,119,110,.28); border-radius: 18px; background: rgba(200,119,110,.08); color: #e4c4c0; }
.stale-notice { margin: 0 14px 14px; padding: 11px 14px; border-radius: 12px; background: rgba(213,179,108,.09); color: #dbc897; font-size: 13px; }

.conversion-row { margin-top: 46px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 24px; padding: 28px 30px; border: 1px solid rgba(213,179,108,.22); border-radius: var(--radius); background: rgba(213,179,108,.07); }
.conversion-row h2 { margin: 0 0 5px; font-family: Georgia, "Times New Roman", serif; font-weight: 500; font-size: 27px; }
.conversion-row p { margin: 0; color: var(--muted); }
.conversion-actions { display: flex; gap: 9px; }
.action-button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; padding: 0 17px; border: 1px solid var(--line); border-radius: 14px; font-size: 13px; font-weight: 950; letter-spacing: .03em; }
.action-button.call { background: var(--ink); color: #101116; }
.action-button.whatsapp { background: var(--green); color: #07120b; border-color: transparent; }
.action-button.quote { background: var(--gold); color: #17130b; border-color: transparent; }
.mobile-conversion { display: none; }

.private-main { padding-top: 50px; }
.private-hero { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 26px; }
.private-hero h1 { font-size: clamp(42px, 6vw, 72px); margin-bottom: 0; }
.private-hero p { margin: 0 0 10px; color: var(--muted); }
.login-wrap { min-height: calc(100vh - 79px); display: grid; place-items: center; padding: 40px 18px; }
.login-card { width: min(480px, 100%); padding: 38px; }
.login-card img { width: 150px; margin-bottom: 32px; }
.login-card h1 { margin: 0 0 12px; font-size: 39px; letter-spacing: -.04em; }
.login-card p { margin: 0 0 28px; color: var(--muted); }
.login-form { display: grid; gap: 12px; }
.login-form label { font-size: 12px; color: #d4cab2; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.login-form input { width: 100%; min-height: 54px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.045); color: var(--ink); padding: 0 15px; }
.login-form button { min-height: 54px; border: 0; border-radius: 14px; background: var(--gold); color: #17130b; font-weight: 950; cursor: pointer; }
.login-error { min-height: 22px; margin: 2px 0 0 !important; color: #e2a39b !important; font-size: 13px; }
.password-help { margin: 0 !important; color: var(--subtle) !important; font-size: 12px; line-height: 1.6; }
.private-nav-actions { display: flex; align-items: center; gap: 10px; }
.admin-link, .logout-button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 0 13px; border: 1px solid var(--line); border-radius: 12px; background: transparent; color: var(--ink); font-size: 11px; font-weight: 900; letter-spacing: .05em; cursor: pointer; }
.admin-main { display: grid; gap: 18px; }
.admin-main .private-hero { margin-bottom: 8px; }
.admin-panel { padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.035); }
.admin-panel h2 { margin: 4px 0 8px; font-family: Georgia, "Times New Roman", serif; font-size: 28px; font-weight: 500; }
.admin-panel p { margin: 0; color: var(--muted); }
.invite-panel { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.primary-control, .secondary-control, .table-action { border: 0; border-radius: 12px; cursor: pointer; font-weight: 900; }
.primary-control { min-height: 50px; padding: 0 18px; background: var(--gold); color: #17130b; white-space: nowrap; }
.secondary-control, .table-action { min-height: 38px; padding: 0 12px; background: rgba(213,179,108,.12); color: #ead29d; }
.copy-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 16px; }
.copy-row input { min-width: 0; min-height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.045); color: var(--ink); }
.admin-note { margin-top: 10px !important; font-size: 13px; }
.table-wrap { overflow-x: auto; margin-top: 18px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th, .admin-table td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.admin-table th { color: var(--subtle); font-size: 10px; letter-spacing: .07em; text-transform: uppercase; }
.status-pill { display: inline-flex; padding: 6px 9px; border-radius: 999px; font-size: 11px; font-weight: 850; }
.status-pill.is-active { background: rgba(92,159,111,.14); color: #a9d6b5; }
.status-pill.is-disabled { background: rgba(200,119,110,.14); color: #e2a39b; }

.private-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(330px, .65fr); gap: 22px; align-items: start; }
.private-sidebar { display: grid; gap: 18px; min-width: 0; }
.financial-summary { position: relative; overflow: hidden; padding: 22px; border: 1px solid rgba(213,179,108,.22); border-radius: 20px; background: linear-gradient(145deg, rgba(213,179,108,.09), rgba(255,255,255,.025) 48%, rgba(255,255,255,.015)); }
.financial-summary::after { content: ""; position: absolute; width: 180px; height: 180px; right: -92px; top: -105px; border: 1px solid rgba(213,179,108,.13); border-radius: 50%; pointer-events: none; }
.financial-summary-header { position: relative; z-index: 1; display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 17px; }
.financial-summary-header h2 { margin: 3px 0 0; font-family: Georgia, "Times New Roman", serif; font-size: 27px; font-weight: 500; }
.financial-summary-header time { max-width: 130px; color: var(--subtle); font-size: 10px; line-height: 1.45; text-align: right; text-transform: uppercase; letter-spacing: .05em; }
.revenue-summary-grid { position: relative; z-index: 1; display: grid; gap: 8px; }
.financial-metric { padding: 13px 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(7,8,11,.45); }
.financial-metric span, .payment-summary-grid span { display: block; color: var(--subtle); font-size: 9px; font-weight: 950; letter-spacing: .08em; text-transform: uppercase; }
.financial-metric strong { display: block; margin-top: 5px; font-family: Georgia, "Times New Roman", serif; font-size: 25px; font-weight: 500; }
.financial-metric.is-completed { border-color: rgba(113,164,126,.24); }
.financial-metric.is-completed strong { color: #b8d9c0; }
.financial-metric.is-planned strong { color: #e0c98f; }
.financial-metric.is-expected { background: rgba(213,179,108,.11); border-color: rgba(213,179,108,.28); }
.financial-metric.is-expected strong { color: #f0d89e; }
.payment-summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.payment-summary-grid article { padding: 12px 13px; border-radius: 13px; background: rgba(255,255,255,.035); }
.payment-summary-grid strong { display: block; margin-top: 5px; font-size: 15px; }
.job-count-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-top: 13px; color: var(--muted); font-size: 10px; text-align: center; }
.job-count-row span { padding: 9px 4px; border-top: 1px solid var(--line); }
.job-count-row strong { display: block; margin-bottom: 2px; color: var(--ink); font-size: 16px; }
.missing-finance-notice { margin: 10px 0 0; padding: 9px 11px; border-radius: 11px; background: rgba(200,119,110,.1); color: #e2b1aa; font-size: 12px; }
.dashboard-panel { padding: 0; }
.dashboard-panel .calendar-grid { padding-bottom: 18px; }
.private-day .day-state { color: #d8bb78; }
.private-day .day-amount { display: block; margin-top: 12px; color: #a8a8ac; font-size: 10px; }
.upcoming-header { padding: 23px 22px 18px; border-bottom: 1px solid var(--line); }
.upcoming-header h2 { margin: 0 0 4px; font-family: Georgia, "Times New Roman", serif; font-size: 27px; font-weight: 500; }
.upcoming-header p { margin: 0; color: var(--muted); font-size: 13px; }
.upcoming-list { max-height: 760px; overflow: auto; padding: 12px; }
.job-card { padding: 17px; border-bottom: 1px solid var(--line); }
.job-card:last-child { border-bottom: 0; }
.job-date { color: var(--gold); font-size: 11px; font-weight: 950; letter-spacing: .09em; text-transform: uppercase; }
.job-card h3 { margin: 6px 0 3px; font-size: 17px; }
.job-card p { margin: 0; color: var(--muted); font-size: 13px; }
.job-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 14px; }
.job-meta div { padding: 9px 10px; border-radius: 11px; background: rgba(255,255,255,.035); }
.job-meta span { display: block; color: var(--subtle); font-size: 9px; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; }
.job-meta strong { display: block; margin-top: 2px; font-size: 12px; overflow-wrap: anywhere; }
.empty-jobs { padding: 42px 22px; text-align: center; color: var(--muted); }

@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
@media (max-width: 900px) {
  .calendar-hero { grid-template-columns: 1fr; gap: 22px; }
  .hero-note { max-width: 620px; }
  .conversion-row { grid-template-columns: 1fr; }
  .private-layout { grid-template-columns: 1fr; }
}
@media (max-width: 650px) {
  body.public-page { padding-bottom: 78px; }
  .calendar-nav { width: min(100% - 26px, 1180px); min-height: 68px; }
  .brand-logo img { width: 124px; }
  .nav-back { padding: 8px 10px; font-size: 11px; }
  .calendar-main { width: min(100% - 24px, 1180px); padding-top: 42px; }
  h1 { font-size: 48px; }
  .calendar-toolbar { min-height: 75px; padding: 15px; }
  .month-button { width: 40px; height: 40px; }
  .weekdays { padding: 0 5px; }
  .weekdays span { padding: 11px 2px; font-size: 9px; }
  .calendar-grid { gap: 4px; padding: 7px; }
  .day-cell { min-height: 74px; padding: 8px; border-radius: 12px; }
  .day-number { font-size: 13px; }
  .day-state { left: 8px; right: 8px; bottom: 8px; gap: 4px; font-size: 0; }
  .day-state::before { width: 8px; height: 8px; }
  .calendar-detail { min-height: 142px; padding: 20px 16px; display: block; }
  .time-list { justify-content: flex-start; margin-top: 13px; }
  .legend { margin-left: 5px; }
  .conversion-row { display: none; }
  .mobile-conversion { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: grid; grid-template-columns: .8fr 1.2fr 1fr; gap: 7px; padding: 9px 10px calc(9px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(7,8,11,.94); backdrop-filter: blur(16px); }
  .mobile-conversion .action-button { min-height: 49px; padding: 0 8px; font-size: 11px; border-radius: 12px; }
  .private-main { width: min(100% - 22px, 1180px); padding-top: 34px; }
  .private-hero { display: block; }
  .private-hero h1 { font-size: 45px; }
  .financial-summary { padding: 18px; }
  .financial-summary-header { align-items: start; }
  .financial-metric strong { font-size: 23px; }
  .login-card { padding: 28px 22px; }
  .invite-panel { align-items: stretch; flex-direction: column; }
  .copy-row { grid-template-columns: 1fr; }
}
