:root {
    --page-bg: #fbf6f3;
    --customer-bg: #fff9f6;
    --surface: #ffffff;
    --surface-muted: #f8eee9;
    --surface-rose: #f4dfe1;
    --primary-rose: #b86f7e;
    --primary-dark: #884557;
    --primary-hover: #733546;
    --text-primary: #332829;
    --text-secondary: #796b6a;
    --border: #eadbd6;
    --success: #2f7d62;
    --success-bg: #e8f5ee;
    --warning: #a86b18;
    --warning-bg: #fff4d8;
    --danger: #b54747;
    --danger-bg: #fff0f0;
    --info: #466b8f;
    --info-bg: #eef5fb;
    --shadow: 0 18px 42px rgba(88, 54, 55, .10);
    --shadow-soft: 0 10px 26px rgba(88, 54, 55, .07);
    --customer-radius: 24px;
    --admin-radius: 16px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --sidebar-width: 248px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
    min-height: 100vh;
    margin: 0;
    color: var(--text-primary);
    background: var(--page-bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    letter-spacing: 0;
}
a { color: inherit; }
button, .primary-button, input, select, textarea { font: inherit; }
button, .primary-button {
    min-height: 42px;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 10px 16px;
    background: var(--surface-muted);
    color: var(--primary-dark);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 800;
    white-space: nowrap;
}
button:hover, .primary-button:hover { border-color: rgba(184, 111, 126, .28); }
.primary-button { background: var(--primary-dark); color: #fff; box-shadow: 0 10px 22px rgba(136, 69, 87, .20); }
.primary-button:hover { background: var(--primary-hover); }
.secondary-button { background: #fff; color: var(--primary-dark); border-color: var(--border); box-shadow: none; }
.danger-button { background: var(--danger-bg); color: var(--danger); border-color: rgba(181, 71, 71, .22); box-shadow: none; }
button:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.wide { width: 100%; }
.muted { color: var(--text-secondary); }
.section-kicker, .eyebrow {
    display: block;
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.notice {
    padding: 13px 15px;
    border-radius: 14px;
    margin: 0 0 var(--space-4);
    border: 1px solid transparent;
    font-weight: 700;
}
.success { background: var(--success-bg); color: var(--success); border-color: rgba(47, 125, 98, .18); }
.error { background: var(--danger-bg); color: var(--danger); border-color: rgba(181, 71, 71, .18); }
.warning { background: var(--warning-bg); color: var(--warning); border-color: rgba(168, 107, 24, .18); }
.info { background: var(--info-bg); color: var(--info); border-color: rgba(70, 107, 143, .18); }
.form-error { color: var(--danger); font-weight: 800; }

label {
    display: grid;
    gap: 7px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 800;
}
input, select, textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 11px 13px;
    background: #fff;
    color: var(--text-primary);
    outline: none;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--primary-rose);
    box-shadow: 0 0 0 4px rgba(184, 111, 126, .13);
}
textarea { resize: vertical; }
.form-stack, .form-grid { display: grid; gap: var(--space-4); }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
.form-grid .wide { grid-column: 1 / -1; }
.inline-form { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-3); flex-wrap: wrap; }
.inline-form input, .inline-form select { width: auto; min-width: 132px; }
.button-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    color: var(--text-secondary);
}
.check-row input { width: auto; min-height: auto; }

.auth-body {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    place-items: center;
    padding: 24px;
    background: linear-gradient(180deg, #fffaf7 0%, #f7eee9 100%);
}
.auth-panel {
    width: 100%;
    max-width: 430px;
    background: rgba(255, 255, 255, .94);
    border: 1px solid rgba(234, 219, 214, .9);
    border-radius: 28px;
    padding: 30px;
    box-shadow: var(--shadow);
}
.auth-panel h1 {
    margin: 0 0 8px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 32px;
    line-height: 1.05;
    color: var(--primary-dark);
    overflow-wrap: anywhere;
}
.auth-panel p { margin: 0 0 24px; color: var(--text-secondary); line-height: 1.5; }
.app-login::before, .auth-panel::before {
    content: "Annur Pantang";
    display: inline-flex;
    margin-bottom: 18px;
    padding: 7px 12px;
    border-radius: 999px;
    background: var(--surface-rose);
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 900;
}
.app-login::before { content: "Annur Care"; }

.customer-body {
    min-height: 100vh;
    background: linear-gradient(180deg, #fff8f5 0%, #fbf1ed 42%, #fffaf7 100%);
    padding-bottom: 94px;
}
.phone-shell {
    width: min(520px, 100%);
    margin: 0 auto;
    padding: var(--space-5) var(--space-4) var(--space-8);
}
.customer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}
.customer-brand { display: grid; gap: 2px; }
.customer-brand strong {
    font-family: Georgia, "Times New Roman", serif;
    color: var(--primary-dark);
    font-size: 22px;
    line-height: 1;
}
.customer-brand span, .customer-chip { color: var(--text-secondary); font-size: 12px; font-weight: 800; }
.customer-chip {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 11px;
    background: rgba(255, 255, 255, .72);
}
.app-hero, .progress-panel, .action-panel, .app-section, .mobile-card {
    background: rgba(255, 255, 255, .94);
    border: 1px solid rgba(234, 219, 214, .92);
    border-radius: var(--customer-radius);
    padding: var(--space-5);
    box-shadow: var(--shadow-soft);
}
.app-hero {
    display: grid;
    gap: var(--space-4);
    background: linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(250, 232, 229, .94));
}
.app-hero p { margin: 0; color: var(--text-secondary); }
.app-hero h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    color: var(--primary-dark);
    font-size: clamp(30px, 8vw, 42px);
    line-height: 1.03;
}
.pantang-day {
    justify-self: start;
    display: inline-flex;
    background: #fff;
    color: var(--primary-dark);
    border: 1px solid rgba(184, 111, 126, .24);
    border-radius: 999px;
    padding: 10px 14px;
    font-weight: 900;
}
.progress-panel, .action-panel, .app-section { margin-top: var(--space-4); }
.progress-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
}
.progress-panel span, .mobile-stat span { color: var(--text-secondary); font-size: 12px; font-weight: 800; }
.progress-panel strong, .mobile-stat strong { display: block; margin-top: 3px; font-size: 21px; }
.progress-bar {
    grid-column: 1 / -1;
    height: 11px;
    background: var(--surface-muted);
    border-radius: 999px;
    overflow: hidden;
}
.progress-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary-rose), var(--primary-dark)); }
.action-panel h2, .app-section h1, .app-section h2 {
    margin: 0 0 var(--space-3);
    font-size: 22px;
    line-height: 1.15;
}
.action-panel p, .app-section p { line-height: 1.55; }
.mobile-list { display: grid; gap: var(--space-3); }
.session-row, .list-row {
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
    align-items: center;
    border-top: 1px solid var(--border);
    padding: 14px 0;
}
.session-row:first-of-type, .list-row:first-of-type { border-top: 0; }
.session-row span, .list-row span { color: var(--text-secondary); text-align: right; }
.slot-card {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 8px 20px rgba(88, 54, 55, .06);
}
.schedule-overview h1 { margin-bottom: var(--space-4); }
.schedule-summary-grid {
    display: grid;
    grid-template-columns: 1.35fr .8fr .8fr;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}
.schedule-summary-grid div {
    min-width: 0;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #fff;
}
.schedule-summary-grid span, .schedule-note span, .previous-time span {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 900;
}
.schedule-summary-grid strong {
    display: block;
    margin-top: 4px;
    font-size: 18px;
    line-height: 1.15;
    overflow-wrap: anywhere;
}
.schedule-section h2 { margin-bottom: var(--space-4); }
.next-treatment-wrap .customer-session-card {
    display: grid;
    gap: var(--space-2);
    padding: var(--space-5);
    border: 1px solid rgba(184, 111, 126, .22);
    border-radius: 22px;
    background: linear-gradient(135deg, #fff, var(--surface-rose));
    box-shadow: 0 10px 24px rgba(88, 54, 55, .08);
}
.next-treatment-wrap .customer-session-card h3 {
    margin: 0;
    color: var(--primary-dark);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 28px;
    line-height: 1.05;
}
.next-treatment-wrap .time-panel strong { font-size: 22px; }
.customer-session-card {
    display: grid;
    gap: var(--space-3);
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(88, 54, 55, .06);
}
.customer-session-card.compact { box-shadow: none; }
.session-card-top {
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
    align-items: flex-start;
}
.session-card-top h3 {
    margin: 4px 0 0;
    font-size: 18px;
    line-height: 1.18;
}
.time-panel {
    display: grid;
    gap: 5px;
    padding: 14px;
    border-radius: 18px;
    background: var(--surface-muted);
}
.time-panel strong {
    color: var(--primary-dark);
    font-size: 20px;
}
.time-panel span:last-child { color: var(--text-secondary); font-weight: 900; }
.muted-panel { background: #f7f3f0; }
.schedule-note {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px var(--space-3);
    align-items: center;
    padding: 12px 0 0;
    border-top: 1px solid var(--border);
}
.schedule-note strong { text-align: right; }
.schedule-note a {
    grid-column: 1 / -1;
    color: var(--primary-dark);
    font-weight: 900;
    text-decoration: none;
}
.previous-time {
    display: grid;
    gap: 3px;
    padding: 11px 13px;
    border-radius: 14px;
    background: #fffaf7;
    border: 1px solid var(--border);
}
.history-toggle, .completed-toggle {
    border-top: 1px solid var(--border);
    padding-top: var(--space-3);
}
.history-toggle summary, .completed-toggle summary {
    color: var(--primary-dark);
    cursor: pointer;
    font-weight: 900;
}
.history-list {
    display: grid;
    gap: var(--space-2);
    margin-top: var(--space-3);
}
.history-list div {
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--surface-muted);
}
.empty-state { text-align: center; }
.bottom-nav {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: 14px;
    z-index: 20;
    width: min(500px, calc(100% - 24px));
    transform: translateX(-50%);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 8px;
    background: rgba(255, 255, 255, .96);
    border: 1px solid rgba(234, 219, 214, .94);
    border-radius: 26px;
    box-shadow: 0 -4px 28px rgba(88, 54, 55, .13);
    backdrop-filter: blur(12px);
}
.bottom-nav a {
    min-height: 54px;
    display: grid;
    place-items: center;
    gap: 3px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 900;
    border-radius: 20px;
}
.bottom-nav a::before {
    content: attr(data-icon);
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--primary-dark);
    font-size: 11px;
}
.bottom-nav a.active { color: var(--primary-dark); background: var(--surface-rose); }

.admin-body { background: #f8f3ef; }
.admin-app {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}
.admin-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    padding: 24px 18px;
    background: #fff;
    border-right: 1px solid var(--border);
}
.brand { display: grid; gap: 3px; text-decoration: none; }
.brand strong {
    font-family: Georgia, "Times New Roman", serif;
    color: var(--primary-dark);
    font-size: 27px;
    line-height: 1;
}
.brand span { color: var(--text-secondary); font-size: 12px; font-weight: 800; }
.admin-nav { display: grid; gap: 6px; }
.admin-nav a, .link-button {
    min-height: 42px;
    justify-content: flex-start;
    border-radius: 14px;
    padding: 10px 12px;
    background: transparent;
    color: var(--text-secondary);
    text-decoration: none;
    box-shadow: none;
}
.admin-nav a:hover, .admin-nav a.active { background: var(--surface-muted); color: var(--primary-dark); }
.admin-sidebar-footer { margin-top: auto; }
.admin-sidebar-footer form { margin: 0; }
.admin-sidebar-footer .link-button { width: 100%; color: var(--danger); }
.admin-main {
    min-width: 0;
    display: grid;
    grid-template-rows: auto 1fr;
}
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    min-height: 70px;
    padding: 14px clamp(18px, 3vw, 34px);
    background: rgba(248, 243, 239, .92);
    border-bottom: 1px solid rgba(234, 219, 214, .8);
    backdrop-filter: blur(12px);
}
.topbar h1 { margin: 0; font-size: 18px; }
.topbar p { margin: 2px 0 0; color: var(--text-secondary); font-size: 13px; }
.nav-toggle { display: none; }
.admin-shell {
    width: min(1220px, 100%);
    margin: 0 auto;
    padding: 24px clamp(16px, 3vw, 34px) 60px;
}
.page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}
.page-heading h1 {
    margin: 0 0 4px;
    font-size: clamp(24px, 3vw, 34px);
    line-height: 1.05;
}
.page-heading p { margin: 0; color: var(--text-secondary); }
.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-4);
}
.metric, .split-grid > div, .table-wrap, .day-column, .suggestion-card, .admin-panel {
    background: var(--surface);
    border: 1px solid rgba(234, 219, 214, .92);
    border-radius: var(--admin-radius);
    padding: var(--space-5);
    box-shadow: var(--shadow-soft);
}
.metric {
    min-height: 118px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.metric span { display: block; color: var(--text-secondary); font-size: 13px; font-weight: 800; }
.metric strong { display: block; font-size: 34px; line-height: 1; }
.metric.attention { border-color: rgba(168, 107, 24, .22); background: linear-gradient(180deg, #fff, #fff8e8); }
.metric.danger { border-color: rgba(181, 71, 71, .2); background: linear-gradient(180deg, #fff, #fff1f1); }
.split-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-5);
    margin-top: var(--space-5);
}
.split-grid h2, .day-column h2, .admin-panel h2 {
    margin: 0 0 var(--space-4);
    font-size: 19px;
}
.dashboard-schedule { grid-template-columns: 1.12fr .88fr; }
.table-wrap { overflow: auto; padding: 0; }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
th { color: var(--text-secondary); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
tr:hover td { background: #fffaf7; }
.pill, .status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(184, 111, 126, .22);
    border-radius: 999px;
    padding: 5px 10px;
    color: var(--primary-dark);
    background: var(--surface-muted);
    font-size: 12px;
    font-weight: 900;
}
.status-soft { background: var(--success-bg); color: var(--success); border-color: rgba(47, 125, 98, .18); }
.appointment-card, .session-card, .block-card {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) auto auto;
    gap: var(--space-3);
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    padding: 13px;
    margin: 10px 0;
    box-shadow: 0 8px 18px rgba(88, 54, 55, .06);
}
.appointment-card time, .block-card time {
    display: grid;
    place-items: center;
    min-height: 52px;
    border-radius: 14px;
    background: var(--surface-rose);
    color: var(--primary-dark);
    font-weight: 900;
}
.appointment-card strong, .session-card strong, .block-card strong { display: block; line-height: 1.2; }
.appointment-card span, .session-card span, .block-card span { color: var(--text-secondary); font-size: 13px; }
.appointment-card a { color: var(--primary-dark); font-weight: 900; text-decoration: none; }
.block-card { grid-template-columns: 104px minmax(0, 1fr) auto auto; background: #fffdfb; }
.google-event-card {
    background: #fff;
    border-color: #cfc8c4;
    box-shadow: none;
}
.google-event-card time {
    background: #f3f1ef;
    color: #5f5855;
}
.google-event-card strong { color: #4d4846; }
.schedule-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
    margin-top: var(--space-5);
}
.schedule-grid.week {
    grid-template-columns: repeat(7, minmax(230px, 1fr));
    overflow-x: auto;
    align-items: start;
}
.day-column { min-width: 0; }
.filter-bar {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: var(--space-3);
    margin: 0 0 var(--space-4);
    padding: var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--admin-radius);
    box-shadow: var(--shadow-soft);
}
.tabs {
    position: sticky;
    top: 70px;
    z-index: 8;
    display: flex;
    gap: var(--space-2);
    overflow-x: auto;
    padding: 10px 0;
    margin-bottom: var(--space-4);
    background: #f8f3ef;
}
.tabs a {
    white-space: nowrap;
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 10px 14px;
    background: #fff;
    color: var(--text-secondary);
    font-weight: 900;
}
.metric-grid.mini { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 10px 0; }
.session-card {
    grid-template-columns: 1fr;
    align-items: stretch;
}
.session-card > .inline-form {
    border-top: 1px solid var(--border);
    padding-top: 10px;
}
.attempt-row {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 10px;
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--surface-muted);
}
.attempt-row strong { font-size: 13px; }
.attempt-row span { font-size: 12px; color: var(--text-secondary); }
.suggestion-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-4);
}
.suggestion-card time {
    display: block;
    color: var(--primary-dark);
    font-weight: 900;
    margin-bottom: var(--space-2);
}
.suggestion-card ul { padding-left: 18px; color: var(--text-secondary); line-height: 1.5; }
.customer-avatar {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: var(--surface-rose);
    color: var(--primary-dark);
    font-weight: 900;
}
.customer-cell {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

@media (max-width: 1023px) {
    .admin-app { grid-template-columns: 1fr; }
    .admin-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 30;
        width: min(300px, 86vw);
        transform: translateX(-105%);
        transition: transform .18s ease;
        box-shadow: var(--shadow);
    }
    .nav-open .admin-sidebar { transform: translateX(0); }
    .nav-toggle { display: inline-flex; }
    .topbar { min-height: 66px; }
    .admin-shell { padding-top: 20px; }
}
@media (max-width: 900px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split-grid, .dashboard-schedule { grid-template-columns: 1fr; }
    .filter-bar { grid-template-columns: 1fr 1fr; }
    .filter-bar input { grid-column: 1 / -1; }
    .appointment-card, .block-card { grid-template-columns: 70px minmax(0, 1fr); }
    .appointment-card > a, .appointment-card > .pill, .block-card form, .block-card span { justify-self: start; }
    .schedule-grid.week { grid-template-columns: repeat(7, 82vw); }
}
@media (max-width: 620px) {
    .form-grid, .button-row, .filter-bar { grid-template-columns: 1fr; }
    .schedule-summary-grid { grid-template-columns: 1fr; }
    .session-card-top { display: grid; }
    .session-card-top .status-badge { justify-self: start; }
    .schedule-note { grid-template-columns: 1fr; }
    .schedule-note strong { text-align: left; }
    .inline-form { display: grid; grid-template-columns: 1fr; }
    .inline-form input, .inline-form select, .inline-form button { width: 100%; }
    .page-heading { align-items: stretch; flex-direction: column; }
    .metric-grid { grid-template-columns: 1fr; }
    .metric-grid.mini { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .appointment-card, .block-card, .slot-card { grid-template-columns: 1fr; }
    .tabs { top: 66px; }
    .admin-shell { padding-inline: 14px; }
    .auth-body { padding: 14px; }
    .auth-panel { max-width: calc(100vw - 28px); padding: 24px; border-radius: 24px; }
    .auth-panel h1 { font-size: 29px; }
}
