:root {
    --ink: #1b2335;
    --muted: #748095;
    --subtle: #a0a9b8;
    --line: #e6eaf1;
    --paper: #f5f7fb;
    --white: #ffffff;
    --violet: #7257df;
    --violet-dark: #5d43c8;
    --violet-soft: #f1eeff;
    --green: #21845f;
    --green-soft: #e8f7f0;
    --amber: #a96e17;
    --amber-soft: #fff4df;
    --shadow: 0 12px 32px rgba(33, 43, 65, .055);
}
* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); font-family: "DM Sans", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.shell { width: min(1440px, calc(100% - 56px)); margin-inline: auto; position: relative; z-index: 1; }
.ambient { position: fixed; pointer-events: none; z-index: 0; border-radius: 50%; filter: blur(2px); }
.ambient-one { width: 420px; height: 420px; top: -220px; right: -120px; background: radial-gradient(circle, rgba(189, 177, 255, .2), transparent 68%); }
.ambient-two { width: 390px; height: 390px; bottom: -240px; left: -180px; background: radial-gradient(circle, rgba(170, 234, 208, .17), transparent 68%); }

/* Halaman booking */
.booking-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; align-items: stretch; gap: 34px; margin: 34px auto 30px; }
.booking-main { min-width: 0; }
.booking-aside { min-height: 600px; display: flex; flex-direction: column; align-self: stretch; padding: 8px 0 10px 28px; border-left: 1px solid #e1e6ee; }
.aside-brand { display: inline-flex; align-self: flex-start; align-items: center; gap: 10px; margin: 0 0 42px; color: var(--ink); font-family: "Space Grotesk", Arial, sans-serif; font-size: 23px; font-weight: 700; letter-spacing: -1.1px; text-decoration: none; }
.brand-light { color: var(--violet); }
.brand-mark { width: 29px; height: 29px; display: flex; align-items: center; justify-content: center; gap: 2px; padding: 6px; border-radius: 9px; background: var(--violet); box-shadow: 0 5px 12px rgba(114, 87, 223, .22); transform: rotate(-6deg); }
.brand-mark span { display: block; width: 3px; border-radius: 4px; background: white; }
.brand-mark span:nth-child(1), .brand-mark span:nth-child(4) { height: 8px; opacity: .78; }
.brand-mark span:nth-child(2) { height: 15px; }
.brand-mark span:nth-child(3) { height: 11px; }
.aside-live { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 42px; }
.live-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid #d8eee3; border-radius: 30px; color: #267c5b; background: #f0faf5; font-size: 10px; font-weight: 800; letter-spacing: .75px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #2ab17b; box-shadow: 0 0 0 3px rgba(42,177,123,.12); }
.topbar-admin-link { display: inline-flex; align-items: center; padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; color: #647086; background: white; text-decoration: none; font-size: 11px; font-weight: 700; transition: .16s ease; }
.topbar-admin-link:hover, .aside-admin-link:hover { border-color: #cbc1ff; color: var(--violet); background: #fbfaff; }
.aside-copy { max-width: 270px; }
.eyebrow, .section-kicker, .modal-kicker { display: flex; align-items: center; gap: 9px; color: #9aa4b3; font-size: 10px; font-weight: 800; letter-spacing: 1.4px; }
.eyebrow-line { width: 20px; height: 1px; background: #9e8be9; }
.aside-copy h1 { margin: 17px 0 13px; font-family: "Space Grotesk", Arial, sans-serif; font-size: clamp(32px, 3vw, 43px); line-height: 1.08; letter-spacing: -2px; }
.aside-copy h1 span { display: block; color: var(--violet); }
.aside-copy p { margin: 0; color: #778397; font-size: 13px; line-height: 1.8; }
.hero-note { display: flex; align-items: center; gap: 9px; margin-top: 23px; color: #66738a; font-size: 11px; line-height: 1.5; }
.note-icon { color: var(--violet); font-size: 17px; }
.aside-bottom { margin-top: auto; padding-top: 30px; }
.aside-admin-hint { margin-bottom: 12px; color: #8d98a8; font-size: 11px; line-height: 1.6; }
.aside-admin-link { display: flex; align-items: center; justify-content: space-between; padding: 14px 15px; border: 1px solid var(--line); border-radius: 10px; color: #6551c3; background: white; font-size: 12px; font-weight: 800; text-decoration: none; transition: .16s ease; }
.aside-admin-link span { font-size: 17px; }
.aside-copyright { margin-top: 18px; color: #a0a9b7; font-size: 10px; }

.schedule-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: 0 0 21px; }
.date-picker-block { flex: 0 0 auto; }
.section-kicker { margin-bottom: 8px; font-size: 9px; letter-spacing: 1.2px; }
.date-control { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; background: white; box-shadow: 0 3px 10px rgba(30,42,60,.025); }
.calendar-icon { color: var(--violet); font-size: 18px; line-height: 1; }
.date-control input { width: 160px; min-width: 0; border: 0; outline: 0; color: #344056; background: transparent; font-size: 13px; font-weight: 700; }
.date-control:focus-within { border-color: #b8aafa; box-shadow: 0 0 0 3px rgba(114,87,223,.09); }
.availability-summary { display: flex; align-items: center; gap: 16px; min-height: 46px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.9); }
.summary-item { display: flex; align-items: center; gap: 7px; color: #7b8799; font-size: 11px; white-space: nowrap; }
.summary-item strong { color: #27334a; font-family: "Space Grotesk", Arial, sans-serif; font-size: 16px; }
.summary-dot { width: 8px; height: 8px; border-radius: 50%; }
.available-dot { background: #42b887; }
.booked-dot { background: #8c79e6; }
.summary-divider { width: 1px; height: 23px; background: #e7ebf1; }
.studio-tabs-wrap { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 0 13px; }
.studio-tabs { display: flex; align-items: center; gap: 7px; max-width: 100%; overflow-x: auto; padding: 3px 2px 6px; scrollbar-width: thin; }
.studio-tab { flex: 0 0 auto; min-height: 40px; padding: 0 17px; border: 1px solid #e2e6ee; border-radius: 9px; color: #68758a; background: rgba(255,255,255,.85); font-size: 12px; font-weight: 800; transition: .16s ease; }
.studio-tab:hover { border-color: #c9c0fa; color: var(--violet); }
.studio-tab.is-active { border-color: var(--violet); color: white; background: var(--violet); box-shadow: 0 5px 13px rgba(114,87,223,.2); }
.timezone-label { display: flex; flex: 0 0 auto; align-items: center; gap: 6px; margin: 0 2px 8px 0; color: #8994a4; font-size: 11px; font-weight: 700; }
.clock-icon { color: var(--violet); font-size: 16px; }
.studio-list { display: block; }
.studio-card { padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: white; box-shadow: var(--shadow); }
.hours-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 9px; }
.hour-slot { min-width: 0; min-height: 104px; display: flex; flex-direction: column; justify-content: space-between; padding: 12px 11px 10px; border: 1px solid #e8ebf2; border-radius: 11px; color: var(--ink); background: #fbfcfe; text-align: left; }
button.hour-slot { appearance: none; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.hour-slot.is-available { cursor: pointer; }
.hour-slot.is-available:hover { transform: translateY(-2px); border-color: #b6a8f5; background: #faf9ff; box-shadow: 0 7px 18px rgba(114,87,223,.1); }
.hour-slot.is-available:focus-visible, .studio-tab:focus-visible, .submit-button:focus-visible { outline: 3px solid rgba(114,87,223,.25); outline-offset: 2px; }
.slot-top { display: flex; align-items: center; justify-content: space-between; gap: 5px; }
.slot-time { color: #29364d; font-family: "Space Grotesk", Arial, sans-serif; font-size: 15px; font-weight: 700; letter-spacing: -.3px; }
.slot-state { flex: 0 0 auto; padding: 4px 6px; border-radius: 5px; color: var(--green); background: var(--green-soft); font-size: 8px; font-weight: 800; letter-spacing: .4px; }
.slot-empty { padding-top: 12px; color: #657187; font-size: 12px; font-weight: 700; }
.slot-bottom { display: flex; align-items: center; gap: 5px; color: #98a2b1; font-size: 10px; }
.slot-plus { color: var(--violet); font-size: 17px; line-height: 1; }
.hour-slot.is-booked { border-color: #e5defe; background: #f5f2ff; }
.is-booked .slot-state { color: #6e55d1; background: #e9e3ff; }
.band-name { overflow: hidden; padding: 11px 0 6px; color: #45358f; font-family: "Space Grotesk", Arial, sans-serif; font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.is-booked .slot-bottom { color: #8e80c7; }
.slot-booked-icon { font-size: 12px; }
.hour-slot.is-past { border-style: dashed; color: #aeb6c1; background: #f7f8fa; }
.is-past .slot-state { color: #929caa; background: #eceff3; }
.is-past .slot-empty, .is-past .slot-bottom { color: #aab3bf; }
.studio-grid-foot { display: flex; justify-content: space-between; gap: 10px; padding: 13px 3px 1px; color: #9aa4b3; font-size: 10px; }
.studio-grid-foot span:first-child { color: #7665c7; font-weight: 800; }
.grid-legend { display: flex; flex-wrap: wrap; gap: 17px; margin: 14px 2px 0; color: #8792a2; font-size: 10px; }
.grid-legend > span { display: inline-flex; align-items: center; gap: 7px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-free { background: #42b887; }
.legend-booked { background: #957ee8; }
.legend-past { background: #b6bec8; }
.empty-studios { display: grid; gap: 7px; min-height: 170px; place-content: center; padding: 20px; border: 1px dashed #d9dfea; border-radius: 13px; color: #758197; text-align: center; background: white; }
.empty-studios strong { color: #303d54; font-size: 15px; }
.empty-studios span { font-size: 12px; }
.is-loading-slot { pointer-events: none; background: #f8f9fb; }
.is-loading-slot .slot-empty { color: #b3bbc5; }

/* Modal booking */
.modal-backdrop[hidden] { display: none; }
.modal-backdrop { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; overflow-y: auto; padding: 20px; background: rgba(19,27,42,.58); backdrop-filter: blur(6px); }
.booking-modal { position: relative; width: min(100%, 470px); padding: 32px; border-radius: 19px; background: white; box-shadow: 0 25px 80px rgba(0,0,0,.22); animation: modal-in .2s ease-out; }
.modal-close { position: absolute; top: 17px; right: 18px; width: 34px; height: 34px; border: 0; border-radius: 9px; color: #788498; background: #f1f3f7; font-size: 23px; line-height: 1; }
.modal-kicker { color: var(--violet); font-size: 9px; }
.booking-modal h2 { margin: 13px 0 7px; font-family: "Space Grotesk", Arial, sans-serif; font-size: 27px; letter-spacing: -.9px; }
.modal-description { margin: 0; color: #7d899a; font-size: 13px; line-height: 1.7; }
.selected-slot { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 22px 0; padding: 13px; border: 1px solid #e7e0ff; border-radius: 10px; background: #f8f6ff; }
.selected-studio { padding: 6px 8px; border-radius: 6px; color: #6e55d1; background: #eae4ff; font-size: 10px; font-weight: 800; }
.selected-slot strong { color: #39305f; font-family: "Space Grotesk", Arial, sans-serif; font-size: 14px; }
.selected-slot > span:last-child { color: #8791a0; font-size: 11px; }
.booking-modal form { display: flex; flex-direction: column; }
.booking-modal label { margin: 13px 0 7px; color: #39465b; font-size: 12px; font-weight: 700; }
.booking-modal label span { color: #d65d69; }
.booking-modal input { width: 100%; height: 46px; padding: 0 13px; outline: 0; border: 1px solid #e1e6ed; border-radius: 9px; color: var(--ink); background: #fcfdff; font-size: 13px; }
.booking-modal input:focus { border-color: #ad9df1; box-shadow: 0 0 0 3px rgba(114,87,223,.1); }
.booking-modal input::placeholder { color: #aab3c0; }
.form-hint { margin: 10px 0 0; color: #8c97a7; font-size: 11px; line-height: 1.6; }
.form-error { min-height: 17px; margin-top: 9px; color: #c54858; font-size: 12px; }
.submit-button { display: flex; align-items: center; justify-content: space-between; min-height: 48px; margin-top: 9px; padding: 0 17px; border: 0; border-radius: 9px; color: white; background: var(--violet); font-size: 13px; font-weight: 800; transition: background .16s, transform .16s; }
.submit-button:hover { transform: translateY(-1px); background: var(--violet-dark); }
.submit-button:disabled { cursor: wait; opacity: .7; }
.button-spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: white; border-radius: 50%; animation: spin .7s linear infinite; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 24px; max-width: calc(100% - 32px); padding: 14px 19px; border-radius: 11px; color: white; background: #1d795c; box-shadow: 0 10px 30px rgba(20,35,47,.2); font-size: 13px; font-weight: 700; opacity: 0; pointer-events: none; transform: translate(-50%, 14px); transition: opacity .2s, transform .2s; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast-error { background: #b84251; }
.modal-open { overflow: hidden; }
.footer { display: flex; justify-content: space-between; gap: 15px; padding: 23px 2px 6px; color: #9ca6b4; font-size: 10px; }

/* Keterangan jika modul database belum diaktifkan */
.setup-error-wrap { min-height: 100vh; display: grid; place-items: center; padding: 28px 18px; }
.setup-error { width: min(100%, 620px); padding: 34px; border: 1px solid #e4e8ef; border-radius: 18px; background: white; box-shadow: var(--shadow); }
.setup-error-mark { width: 42px; height: 42px; display: grid; place-items: center; margin-bottom: 19px; border-radius: 13px; color: #9a671c; background: #fff2d9; font-size: 22px; font-weight: 800; }
.setup-error h1 { margin: 12px 0 8px; font-family: "Space Grotesk", Arial, sans-serif; font-size: 28px; letter-spacing: -.8px; }
.setup-error p { color: #68758a; font-size: 14px; line-height: 1.7; }
.setup-error-detail { margin: 16px 0; padding: 12px 14px; border-radius: 9px; color: #835d20; background: #fff7e8; font-size: 12px; line-height: 1.6; }
.setup-error-help { color: #69768b; font-size: 13px; line-height: 1.8; }
.setup-error-help ol { padding-left: 20px; }
.setup-error code { padding: 2px 5px; border-radius: 4px; color: #55429d; background: #f2efff; font-size: .92em; }
.setup-retry { display: inline-flex; margin-top: 14px; padding: 11px 15px; border-radius: 9px; color: white; background: var(--violet); text-decoration: none; font-size: 12px; font-weight: 800; }

@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* Laptop dan tablet landscape: grid kiri, informasi kanan */
@media (max-width: 1180px) and (orientation: landscape) {
    .shell { width: min(100% - 38px, 1440px); }
    .booking-layout { grid-template-columns: minmax(0, 1fr) 250px; gap: 23px; margin-top: 25px; }
    .booking-aside { padding-left: 21px; }
    .aside-brand { margin-bottom: 32px; }
    .aside-live { margin-bottom: 30px; }
    .aside-copy h1 { font-size: 34px; }
    .hours-grid { gap: 7px; }
    .hour-slot { min-height: 88px; padding: 10px 8px 9px; }
    .slot-time { font-size: 13px; }
    .slot-empty { font-size: 11px; }
    .band-name { font-size: 12px; }
}

/* Portrait: hanya logo floating dan area booking */
@media (max-width: 900px), (orientation: portrait) and (max-width: 1100px) {
    .booking-layout { display: block; width: min(calc(100% - 34px), 850px); margin: 78px auto 24px; }
    .booking-main { width: 100%; }
    .booking-aside { display: contents; }
    .aside-brand { position: fixed; z-index: 25; top: 12px; left: 16px; display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 8px 12px 8px 9px; border: 1px solid rgba(226,230,238,.95); border-radius: 12px; background: rgba(255,255,255,.96); box-shadow: 0 6px 20px rgba(33,43,60,.11); font-size: 17px; backdrop-filter: blur(12px); }
    .aside-brand .brand-mark { width: 23px; height: 23px; padding: 4px; margin: 0; }
    .aside-live, .aside-copy, .aside-bottom { display: none; }
    .studio-card { padding: 12px; }
}
@media (max-width: 600px) {
    .shell { width: calc(100% - 22px); }
    .booking-layout { width: calc(100% - 22px); margin-top: 70px; }
    .schedule-toolbar { align-items: stretch; flex-direction: column; gap: 12px; margin-bottom: 15px; }
    .date-picker-block { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
    .date-picker-block .section-kicker { margin: 0; }
    .date-control { min-height: 42px; padding-inline: 10px; }
    .date-control input { width: 145px; font-size: 12px; }
    .availability-summary { justify-content: space-around; width: 100%; min-height: 42px; padding: 8px 9px; gap: 9px; }
    .summary-item { gap: 6px; font-size: 10px; }
    .summary-item strong { font-size: 14px; }
    .studio-tabs-wrap { align-items: center; margin-bottom: 9px; }
    .studio-tabs { gap: 6px; }
    .studio-tab { min-height: 37px; padding-inline: 13px; font-size: 11px; }
    .timezone-label { display: none; }
    .studio-card { padding: 8px; border-radius: 12px; }
    .hours-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
    .hour-slot { min-height: 84px; padding: 9px 7px 8px; border-radius: 9px; }
    .slot-time { font-size: 12px; }
    .slot-state { padding: 3px 5px; font-size: 7px; }
    .slot-empty { padding-top: 9px; font-size: 10px; }
    .slot-bottom { font-size: 8px; }
    .band-name { padding: 8px 0 4px; font-size: 10px; }
    .studio-grid-foot { padding-top: 10px; font-size: 9px; }
    .grid-legend { gap: 10px; margin-top: 11px; font-size: 9px; }
    .booking-modal { padding: 27px 22px; }
    .booking-modal h2 { font-size: 24px; }
    .footer { flex-direction: column; gap: 5px; }
}
@media (max-width: 370px) {
    .hours-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .date-picker-block { align-items: flex-start; flex-direction: column; }
    .date-control { width: 100%; }
    .date-control input { width: 100%; }
    .summary-item { font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Runtime fallback: tampilkan pesan yang jelas bila HTML dan JavaScript tidak cocok. */
.runtime-error-notice {
    position: relative;
    z-index: 10000;
    width: min(720px, calc(100% - 32px));
    margin: 24px auto;
    padding: 14px 16px;
    border: 1px solid #f2b8b5;
    border-radius: 12px;
    background: #fff2f1;
    color: #8f2420;
    font: 600 14px/1.5 "DM Sans", sans-serif;
    box-shadow: 0 8px 24px rgba(25, 20, 20, .08);
}

/* Logo gambar dapat diatur dari dashboard admin. */
.brand-image { display: block; width: 36px; height: 36px; flex: 0 0 36px; object-fit: contain; border-radius: 8px; }
@media (max-width: 1100px) and (orientation: portrait), (max-width: 900px) {
    .aside-brand .brand-image { width: 28px; height: 28px; flex-basis: 28px; }
}
