:root {
  color-scheme: light;
  --ink: #15342f;
  --muted: #60736f;
  --green: #087f68;
  --green-dark: #05634f;
  --line: #d8e7e2;
  --soft: #f3faf7;
  --white: #fff;
  --danger: #b42318;
  --warning: #a15c00;
  --shadow: 0 18px 48px rgba(16, 65, 55, .1);
}

* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; background: #f7fbf9; color: var(--ink); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at top right, #dff5ec 0, transparent 34rem); }
button, input, select, textarea { font: inherit; }
button { touch-action: manipulation; }
[hidden] { display: none !important; }

.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left));
  background: rgba(255, 255, 255, .95); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px);
}
.brand { display: flex; gap: 8px; align-items: center; color: var(--ink); font-weight: 800; text-decoration: none; }
.brand span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--green); color: #fff; }
.home-link, .back-button { border: 0; background: transparent; color: var(--green-dark); font-weight: 700; text-decoration: none; cursor: pointer; }
.shell { width: min(980px, 100%); margin: 0 auto; padding: 22px 12px calc(105px + env(safe-area-inset-bottom)); }

.state-card { padding: 40px 22px; text-align: center; background: var(--white); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.state-card h1 { font-size: clamp(1.35rem, 5vw, 2rem); line-height: 1.25; }
.state-card p, .section-heading p, .muted { color: var(--muted); line-height: 1.6; }
.spinner { width: 44px; height: 44px; margin: auto; border: 4px solid #dceee8; border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.state-icon { display: grid; place-items: center; width: 66px; height: 66px; margin: auto; border-radius: 20px; background: var(--soft); font-size: 2rem; color: var(--green); }
.state-actions { display: grid; gap: 10px; margin-top: 24px; }
.button { display: block; padding: 13px 16px; border: 1px solid var(--line); border-radius: 13px; background: #fff; color: var(--ink); font-weight: 700; text-decoration: none; }
.button.primary { background: var(--green); border-color: var(--green); color: #fff; }

.eyebrow { margin: 0 0 5px; color: var(--green) !important; text-transform: uppercase; letter-spacing: .09em; font-size: .7rem; font-weight: 800; }
.section-heading h1 { margin: 0; font-size: clamp(1.7rem, 7vw, 2.5rem); }
.home-list { display: grid; gap: 12px; margin-top: 22px; }
.home-card { display: grid; grid-template-columns: 72px 1fr auto; align-items: center; gap: 12px; width: 100%; padding: 11px; border: 1px solid var(--line); border-radius: 18px; background: #fff; color: var(--ink); text-align: left; box-shadow: 0 8px 25px rgba(16,65,55,.06); cursor: pointer; }
.home-card img { width: 72px; height: 72px; border-radius: 13px; object-fit: cover; }
.home-card strong, .home-card small { display: block; }
.home-card small { margin-top: 5px; color: var(--muted); }
.home-card span { font-size: 1.4rem; color: var(--green); }
.back-button { padding: 8px 0; margin-bottom: 10px; }
.home-heading { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; align-items: center; margin-bottom: 16px; }
.home-heading img { width: 72px; height: 72px; object-fit: cover; border-radius: 17px; background: #e7f1ed; }
.home-heading h1 { margin: 0; font-size: clamp(1.25rem, 5.5vw, 1.8rem); overflow-wrap: anywhere; }
.verification { display: inline-block; margin: 6px 0 0; padding: 4px 8px; border-radius: 999px; background: #fff5cc; color: #795c00; font-size: .7rem; font-weight: 700; }

.workspace { min-height: 520px; }
.tab-panel { animation: panel-in .18s ease; }
@keyframes panel-in { from { opacity: .55; transform: translateY(3px); } }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.panel-title h2 { margin: 0; font-size: 1.55rem; }
.quick-booking, .save-button { min-height: 44px; padding: 11px 15px; border: 0; border-radius: 13px; background: var(--green); color: #fff; font-weight: 800; cursor: pointer; }

.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 18px 0; }
.metric-card { display: grid; align-content: space-between; min-height: 105px; padding: 15px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 7px 20px rgba(16,65,55,.05); }
.metric-card strong { font-size: 1.3rem; line-height: 1.1; overflow-wrap: anywhere; }
.metric-card span { color: var(--muted); font-size: .78rem; line-height: 1.35; }
.metric-card.success { background: #e9fbf4; border-color: #afe5d3; }
.metric-card.warning { background: #fff8e6; border-color: #f5d79e; }
.metric-card.money { background: #eef6ff; border-color: #c8dcf4; }
.metric-card.muted-card strong { font-size: .9rem; color: var(--muted); }
.action-card, .share-card, .coming-card { padding: 17px; border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: 0 8px 24px rgba(16,65,55,.05); }
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.quick-actions button, .resource-filter button, .booking-actions button, .day-actions button, .rooms-heading button, .room-row button, .share-row button {
  min-height: 40px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); font-weight: 700; cursor: pointer;
}

.calendar-toolbar { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; margin: 16px 0 10px; text-align: center; }
.calendar-toolbar button { height: 42px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--green-dark); font-size: 1.5rem; }
.calendar-legend { display: flex; gap: 6px; padding: 4px 0 10px; overflow-x: auto; scrollbar-width: none; }
.calendar-legend span { flex: 0 0 auto; padding: 5px 8px; border-radius: 999px; background: #eaf4f1; font-size: .68rem; font-weight: 700; }
.calendar-legend span::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: #9eaaa7; }
.calendar-legend span[data-status="AVAILABLE"]::before { background: #1b9a6d; }
.calendar-legend span[data-status="BOOKED"]::before { background: #cf3b31; }
.calendar-legend span[data-status="HOLD"]::before { background: #e39a16; }
.calendar-legend span[data-status="BLOCKED"]::before { background: #687572; }
.calendar-legend span[data-status="OWNER_USE"]::before { background: #7457c5; }
.calendar-legend span[data-status="MAINTENANCE"]::before { background: #2674b9; }
.resource-filter { display: flex; gap: 7px; margin: 4px 0 12px; overflow-x: auto; }
.resource-filter button { flex: 0 0 auto; }
.resource-filter button.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.weekday { padding: 6px 0; color: var(--muted); text-align: center; font-size: .67rem; font-weight: 800; }
.calendar-day { display: grid; place-items: center; align-content: center; min-width: 0; min-height: 58px; padding: 5px 2px; border: 1px solid transparent; border-radius: 11px; background: #e9fbf4; color: #075b48; cursor: pointer; }
.calendar-day strong { font-size: 1rem; }
.calendar-day small { width: 100%; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; font-size: .56rem; white-space: nowrap; }
.calendar-day[data-status="BOOKED"] { background: #fff0ee; color: #9b231c; }
.calendar-day[data-status="HOLD"] { background: #fff6df; color: #8a5200; }
.calendar-day[data-status="BLOCKED"] { background: #edf0ef; color: #3f4d49; }
.calendar-day[data-status="OWNER_USE"] { background: #f0ecff; color: #5237a4; }
.calendar-day[data-status="MAINTENANCE"] { background: #eaf4ff; color: #165c98; }
.calendar-tools { margin-top: 14px; }
.share-card { display: grid; gap: 12px; margin-top: 14px; }
.share-card p { margin: 5px 0 0; color: var(--muted); font-size: .8rem; line-height: 1.45; }
.share-row { display: grid; gap: 8px; }

.booking-list { display: grid; gap: 12px; margin-top: 15px; }
.booking-card { padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 7px 22px rgba(16,65,55,.05); }
.booking-card > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.booking-card p { margin: 8px 0; color: var(--muted); font-size: .82rem; line-height: 1.4; }
.booking-status { flex: 0 0 auto; padding: 4px 8px; border-radius: 999px; background: #e9fbf4; color: #087258; font-size: .67rem; font-weight: 800; }
.booking-status[data-status="PENDING_CONFIRMATION"] { background: #fff6df; color: #8a5200; }
.booking-status[data-status="CANCELLED"] { background: #edf0ef; color: #5f6d69; }
.booking-money { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding-top: 9px; border-top: 1px dashed var(--line); font-size: .72rem; }
.booking-money strong { color: var(--green-dark); }
.booking-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.commission-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding: 10px; border-radius: 12px; background: #fff8e6; color: #76520c; font-size: .75rem; font-weight: 750; }
.commission-row button { flex: 0 0 auto; min-height: 36px; padding: 7px 10px; border: 1px solid #e5c77f; border-radius: 10px; background: #fff; color: #76520c; font-weight: 750; }
.danger-outline { border-color: #efc5c1 !important; color: var(--danger) !important; background: #fff !important; }
.empty-list { padding: 35px 18px; border: 1px dashed #bed5ce; border-radius: 18px; color: var(--muted); text-align: center; }
.coming-card { margin-top: 28px; padding: 34px 22px; text-align: center; }
.coming-card > span { display: grid; place-items: center; width: 60px; height: 60px; margin: auto; border-radius: 20px; background: var(--soft); color: var(--green); font-size: 1.8rem; font-weight: 800; }
.coming-card p { color: var(--muted); line-height: 1.6; }
.attention-card { display: grid; gap: 12px; margin: 14px 0; padding: 16px; border: 1px solid #c9dfd8; border-radius: 20px; background: linear-gradient(145deg,#fff,#f1fbf8); box-shadow: 0 10px 28px rgba(16,65,55,.06); }
.attention-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.attention-heading h3 { margin: 0; font-size: 1.2rem; }.attention-heading button { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--green-dark); font-weight: 800; }
.attention-metrics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }.attention-metrics .metric-card { margin: 0; }
.attention-list { display: grid; gap: 7px; }.attention-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.attention-item > div { min-width: 0; }.attention-item strong,.attention-item small { display: block; }.attention-item strong { overflow-wrap: anywhere; }.attention-item small { margin-top: 4px; color: var(--muted); font-size: .68rem; line-height: 1.35; }
.attention-item .task-priority { flex: 0 0 auto; }.attention-item .task-priority[data-priority="HIGH"] { background: #fff0eb; color: #9c3d2f; }.attention-empty { margin: 0; padding: 13px; border: 1px dashed var(--line); border-radius: 13px; color: var(--muted); text-align: center; font-size: .78rem; }

.manager-form { display: grid; gap: 16px; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.manager-form h3 { margin: 0; }
.manager-form label, .manage-dialog label { display: grid; gap: 7px; color: #294b44; font-size: .85rem; font-weight: 700; }
.manager-form small, .manage-dialog small { font-weight: 500; color: var(--muted); }
input, select, textarea { width: 100%; min-width: 0; padding: 12px; border: 1px solid #bfd3cd; border-radius: 12px; background: #fff; color: var(--ink); outline: none; }
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(8,127,104,.12); }
.two-columns { display: grid; gap: 14px; }
.notice { padding: 12px; border-radius: 12px; background: var(--soft); color: #3d5f57; font-size: .82rem; line-height: 1.55; }
.save-button:disabled { opacity: .6; }
.form-status { min-height: 1.3em; margin: 0; text-align: center; color: var(--green-dark); font-weight: 700; }
.form-status.error { color: var(--danger); }
.rooms-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 0; }
.room-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 8px; }
.profile-details { margin-top: 14px; }
.profile-details summary { padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: #fff; color: var(--green-dark); font-weight: 800; cursor: pointer; }
.profile-details[open] summary { margin-bottom: 10px; }
.sale-management, .staff-management { display: grid; gap: 14px; margin-bottom: 22px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.subsection-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.subsection-heading h3 { margin: 0; font-size: 1.2rem; }
.subsection-heading a { color: var(--green); font-size: .78rem; font-weight: 800; }
.sale-list { display: grid; gap: 10px; }
.sale-card { padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.sale-card > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sale-card p { margin: 7px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.45; overflow-wrap: anywhere; }
.operations-heading { align-items: end; }
.operations-heading label { display: grid; gap: 4px; color: var(--muted); font-size: .72rem; font-weight: 750; }
.operations-heading input { width: 145px; padding: 9px 10px; }
.housekeeping-list { display: grid; gap: 10px; }
.housekeeping-card { display: grid; gap: 9px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.housekeeping-card > div:first-child { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.housekeeping-card small { color: var(--muted); }
.housekeeping-controls { display: grid; grid-template-columns: minmax(0,.8fr) minmax(0,1.2fr) auto; gap: 7px; }
.housekeeping-controls select, .housekeeping-controls input, .housekeeping-controls button { padding: 9px; font-size: .76rem; }
.operations-task-list, .handoff-list { display: grid; gap: 10px; }
.operations-task-card, .handoff-card { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.operations-task-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.operations-task-card p, .handoff-card p { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.5; overflow-wrap: anywhere; }
.task-priority { padding: 4px 7px; border-radius: 999px; background: var(--soft); color: var(--green-dark); font-size: .66rem; font-weight: 850; white-space: nowrap; }
.task-priority[data-priority="HIGH"] { background: #fff0eb; color: #9c3d2f; }
.task-priority[data-priority="LOW"] { background: #edf2f1; color: #61716d; }
.task-update { display: grid; grid-template-columns: minmax(0,.8fr) minmax(0,1.2fr) auto; gap: 7px; }
.task-update select, .task-update input, .task-update button { padding: 9px; font-size: .76rem; }
.handoff-form { display: grid; gap: 8px; }
.handoff-card header { display: flex; justify-content: space-between; gap: 8px; }
.handoff-card time { color: var(--muted); font-size: .68rem; }
.form-actions { display: flex; gap: 8px; }
.form-actions > * { flex: 1; }
.booking-status[data-status="INACTIVE"], .booking-status[data-status="REJECTED"], .booking-status[data-status="CANCELLED"], .booking-status[data-status="EXPIRED"] { background: #edf0ef; color: #5f6d69; }
.booking-status[data-status="REQUESTED"] { background: #eef6ff; color: #245f94; }
.booking-status[data-status="APPROVED"] { background: #fff6df; color: #8a5200; }

.finance-title { align-items: end; }
.finance-title label { display: grid; gap: 4px; color: var(--muted); font-size: .72rem; font-weight: 750; }
.finance-title input { width: 145px; padding: 9px 10px; }
.finance-health, .finance-report { margin-top: 14px; padding: 17px; border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: 0 8px 24px rgba(16,65,55,.05); }
.finance-health h3, .finance-report h3 { margin: 0; font-size: 1.25rem; }
.finance-message { margin: 9px 0 0; color: var(--green-dark); font-weight: 750; line-height: 1.5; }
.finance-metrics { margin-bottom: 0; }
.finance-form { margin-top: 14px; }
.finance-form h4 { margin: 4px 0 -5px; color: var(--green-dark); }
.cost-head, .finance-cost-row { display: grid; grid-template-columns: minmax(105px,1fr) minmax(0,.8fr) minmax(0,.8fr); gap: 7px; align-items: center; }
.cost-head { padding: 0 4px; color: var(--muted); font-size: .65rem; font-weight: 800; text-align: center; }
.cost-head span:first-child { text-align: left; }
.cost-list { display: grid; gap: 8px; }
.finance-cost-row { padding: 10px; border: 1px solid var(--line); border-radius: 13px; background: #fbfefd; }
.finance-cost-row strong { min-width: 0; font-size: .76rem; line-height: 1.3; }
.finance-cost-row label { display: block; }
.finance-cost-row label span { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.finance-cost-row input { padding: 9px 7px; text-align: right; font-size: .78rem; }

.bottom-nav { position: fixed; left: 50%; bottom: 0; z-index: 18; display: grid; grid-template-columns: repeat(5, 1fr); width: min(100%, 980px); padding: 7px 5px calc(7px + env(safe-area-inset-bottom)); transform: translateX(-50%); border-top: 1px solid var(--line); background: rgba(255,255,255,.97); box-shadow: 0 -10px 30px rgba(16,65,55,.08); backdrop-filter: blur(14px); }
.bottom-nav button { display: grid; place-items: center; gap: 2px; min-width: 0; min-height: 48px; padding: 3px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); font-size: .64rem; font-weight: 750; cursor: pointer; }
.bottom-nav button span { font-size: 1.05rem; }
.bottom-nav button.active { background: var(--soft); color: var(--green-dark); }

.manage-dialog { width: min(620px, calc(100% - 20px)); max-height: calc(100dvh - 20px); margin: auto; padding: 0; border: 0; border-radius: 22px; color: var(--ink); box-shadow: 0 28px 80px rgba(7,49,40,.25); }
.manage-dialog:not([open]) { display: none; }
.manage-dialog::backdrop { background: rgba(7,28,24,.55); backdrop-filter: blur(3px); }
.manage-dialog form, .day-dialog { display: grid; gap: 14px; padding: 18px; overflow-y: auto; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog-heading h2 { margin: 0; }
.dialog-heading > button { width: 40px; height: 40px; border: 0; border-radius: 12px; background: var(--soft); color: var(--ink); font-size: 1.5rem; }
.booking-calculation { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; border-radius: 12px; background: var(--soft); }
.day-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.day-actions .save-button, .day-actions .danger-outline { grid-column: 1 / -1; }

@media (max-width: 480px) {
  .housekeeping-controls, .task-update { grid-template-columns: 1fr; }
}

@media (min-width: 680px) {
  .shell { padding: 40px 20px 112px; }
  .state-actions, .two-columns { grid-template-columns: 1fr 1fr; }
  .home-heading { grid-template-columns: 96px 1fr; }
  .home-heading img { width: 96px; height: 96px; }
  .metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .attention-metrics { grid-template-columns: repeat(5,minmax(0,1fr)); }
  .manager-form, .manage-dialog form, .day-dialog { padding: 26px; }
  .share-row { grid-template-columns: 1fr auto auto; }
  .calendar-grid { gap: 7px; padding: 12px; }
  .calendar-day { min-height: 78px; }
  .calendar-day small { font-size: .67rem; }
  .bottom-nav { bottom: 12px; width: min(620px, calc(100% - 30px)); border: 1px solid var(--line); border-radius: 22px; padding: 7px; }
  .finance-health, .finance-report { padding: 22px; }
  .finance-cost-row { grid-template-columns: minmax(180px,1.2fr) minmax(130px,.8fr) minmax(130px,.8fr); }
}
