html, body {
    background: #f6f4ef;
    color: #262626;
    font-family: "Segoe UI", Arial, sans-serif;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    overflow-x: hidden;
}

a, .btn-link {
    color: #7b3f54;
}

h1, h2 {
    letter-spacing: 0;
}

h1 {
    font-size: 2rem;
    margin: 0;
}

h1:focus {
    outline: none;
}

h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

section, .auth-panel {
    background: #fff;
    border: 1px solid #e0d9cc;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.content {
    padding-top: 1.5rem;
    padding-bottom: 2rem;
}

.btn-primary {
    background-color: #7b3f54;
    border-color: #7b3f54;
}

.btn-primary:hover {
    background-color: #693548;
    border-color: #693548;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-select:focus {
    box-shadow: 0 0 0 0.2rem rgba(123, 63, 84, .18);
    border-color: #7b3f54;
}

.page-header {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.page-header p {
    color: #6f6a61;
    margin: .25rem 0 0;
}

.toolbar {
    align-items: end;
    display: flex;
    gap: .75rem;
}

.toolbar .form-control {
    min-width: 220px;
}

.auth-panel {
    margin: 4rem auto;
    max-width: 480px;
}

.form-grid {
    display: grid;
    gap: .9rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.compact {
    grid-template-columns: 1fr;
}

.form-grid label {
    color: #4d4942;
    font-weight: 600;
}

.form-grid input, .form-grid textarea, .form-grid select {
    margin-top: .35rem;
}

.client-profile-form {
    max-width: 980px;
}

.span-2 {
    grid-column: span 2;
}

.appointment-list-time {
    min-width: 210px;
    white-space: nowrap;
}

.service-picker {
    color: #4d4942;
}

.service-options {
    display: grid;
    gap: .45rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: .45rem;
}

.service-option {
    align-items: center;
    background: #faf9f6;
    border: 1px solid #e0d9cc;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    gap: .5rem;
    min-height: 2.6rem;
    padding: .45rem .6rem;
}

.service-option:has(input:checked) {
    background: #f4e8ed;
    border-color: #b98999;
}

.service-option input {
    flex: 0 0 auto;
    margin: 0;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.inline-form {
    align-items: center;
    display: grid;
    gap: .5rem;
    grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) auto;
}

.password-field {
    align-items: stretch;
    display: grid;
    gap: .4rem;
    grid-template-columns: minmax(0, 1fr) auto;
    margin-top: .35rem;
}

.password-field .form-control {
    margin-top: 0;
}

.password-field .btn {
    min-width: 78px;
}

.checkbox-row {
    align-items: center;
    display: flex;
    gap: .5rem;
    margin-top: 1.8rem;
}

.checkbox-row input {
    margin: 0;
}

.form-control-color {
    min-height: 2.4rem;
    padding: .25rem;
    width: 100%;
}

.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
}

.color-swatch {
    border: 2px solid #d8d1c5;
    border-radius: 999px;
    height: 28px;
    width: 28px;
}

.color-swatch.selected {
    border-color: #2f2a27;
    box-shadow: 0 0 0 2px rgba(47, 42, 39, .14);
}

.color-dot {
    border: 1px solid rgba(47, 42, 39, .2);
    border-radius: 999px;
    display: inline-block;
    height: .85rem;
    margin-right: .35rem;
    vertical-align: -.1rem;
    width: .85rem;
}

.appointment-row > td {
    background: color-mix(in srgb, var(--appointment-row-color, #efe5e9) 42%, #fff);
}

.appointment-row:hover > td {
    background: color-mix(in srgb, var(--appointment-row-color, #efe5e9) 58%, #fff);
}

.appointment-row.first-visit > td:first-child {
    border-left: 5px solid #198754;
}

.appointment-row.first-visit > td:first-child::after {
    color: #146c43;
    content: "Prvi dolazak";
    display: block;
    font-size: .7rem;
    font-weight: 700;
}

.status-pill {
    border-radius: 999px;
    display: inline-block;
    font-size: .82rem;
    padding: .18rem .5rem;
    white-space: nowrap;
}

.status-current {
    background: #d1e7dd;
    color: #0f5132;
}

.status-late {
    background: #f8d7da;
    color: #842029;
}

.status-next {
    background: #cff4fc;
    color: #055160;
}

.status-active {
    background: #d1e7dd;
    color: #0f5132;
}

.status-muted {
    background: #eee9e2;
    color: #5f5850;
}

.stylist-legend {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .65rem 1.1rem;
    padding: .75rem 1rem;
}

.stylist-legend span {
    white-space: nowrap;
}

.quick-time-slots {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-bottom: 1rem;
}

.two-column {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr) minmax(320px, .75fr);
}

.two-column.wide-left {
    grid-template-columns: minmax(0, 1.35fr) minmax(340px, .65fr);
}

.metric-grid, .summary-band, .info-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 1rem;
}

.metric, .summary-band div, .info-grid div {
    background: #fff;
    border: 1px solid #e0d9cc;
    border-radius: 8px;
    padding: 1rem;
}

.metric span, .summary-band span, .info-grid span {
    color: #6f6a61;
    display: block;
    font-size: .85rem;
}

.metric strong, .summary-band strong, .info-grid strong {
    display: block;
    font-size: 1.35rem;
    margin-top: .25rem;
    overflow-wrap: anywhere;
}

.table-wrap {
    overflow-x: auto;
}

.dashboard-today-appointments {
    max-height: 28rem;
    overflow-y: auto;
}

.dashboard-today-appointments thead th {
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 1;
}

.holiday-year {
    max-width: 8rem;
}

.working-hours-days-off {
    max-height: 32rem;
    overflow-y: auto;
}

.table {
    margin-bottom: 0;
}

.actions {
    white-space: nowrap;
}

.actions .btn {
    margin: .1rem;
}

.muted {
    color: #6f6a61;
}

.list-stack {
    display: grid;
    gap: .5rem;
}

.list-row {
    align-items: center;
    border: 1px solid #e0d9cc;
    border-radius: 8px;
    color: inherit;
    display: flex;
    justify-content: space-between;
    padding: .75rem;
    text-decoration: none;
}

.list-row .actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    justify-content: flex-end;
}

.list-row small {
    color: #6f6a61;
    display: block;
    margin-top: .15rem;
}

.upcoming-appointments {
    margin-bottom: 1.5rem;
}

.appointment-editor {
    border: 1px solid #e0d9cc;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    padding: 1rem;
}

.appointment-editor h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.timeline {
    display: grid;
    gap: .75rem;
}

.timeline-item {
    border: 1px solid #e0d9cc;
    border-radius: 8px;
    padding: 1rem;
}

.timeline-head {
    align-items: start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.timeline-head span {
    color: #6f6a61;
    display: block;
}

.timeline dl {
    display: grid;
    gap: .35rem .75rem;
    grid-template-columns: 110px minmax(0, 1fr);
    margin: .75rem 0 0;
}

.timeline dt {
    color: #6f6a61;
    font-weight: 600;
}

.timeline dd {
    margin: 0;
}

.total-box {
    background: #f6f4ef;
    border: 1px solid #e0d9cc;
    border-radius: 8px;
    padding: .75rem;
}

.hint-box {
    background: #f6f4ef;
    border: 1px solid #e0d9cc;
    border-radius: 8px;
    color: #6f6a61;
    padding: .65rem .75rem;
}

.calendar-grid {
    display: grid;
    gap: .35rem;
    grid-template-columns: repeat(7, minmax(120px, 1fr));
    margin-bottom: 1rem;
}

.calendar-weekday {
    background: #2f2a27;
    border-radius: 6px;
    color: #fff;
    font-size: .88rem;
    font-weight: 700;
    padding: .5rem .6rem;
    text-align: center;
}

.calendar-day {
    background: #fff;
    border: 1px solid #e0d9cc;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    height: 138px;
    min-height: 0;
    overflow: hidden;
    padding: .5rem;
}

.calendar-day.selected-day {
    border-color: #7b3f54;
    box-shadow: inset 0 0 0 1px #7b3f54;
}

.calendar-day.empty-calendar-day {
    cursor: pointer;
}

.calendar-day.empty-calendar-day:hover {
    background: #fbf7f8;
    border-color: #b98999;
}

.calendar-day-header {
    align-items: center;
    background: transparent;
    border: 0;
    color: inherit;
    display: flex;
    justify-content: space-between;
    padding: 0;
    text-align: left;
    width: 100%;
}

.calendar-day-header strong {
    font-size: 1.05rem;
}

.calendar-day-header span {
    background: #7b3f54;
    border-radius: 999px;
    color: #fff;
    font-size: .75rem;
    min-width: 1.45rem;
    padding: .1rem .35rem;
    text-align: center;
}

.calendar-items-preview {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.muted-day {
    background: #faf9f6;
    color: #918a7d;
}

.calendar-item {
    background: #efe5e9;
    border: 1px solid #d9c6ce;
    border-radius: 6px;
    color: #3d2931;
    display: block;
    font-size: .78rem;
    margin-top: .25rem;
    padding: .18rem .3rem;
    text-align: left;
    text-decoration: none;
    width: 100%;
}

.calendar-item strong,
.calendar-item small,
.calendar-item span {
    display: block;
    line-height: 1.25;
}

.calendar-item small {
    color: #6f6a61;
}

.calendar-item:hover {
    background: #e4d2da;
    color: #2f1d25;
}

.calendar-more {
    background: transparent;
    border: 0;
    color: #7b3f54;
    font-size: .78rem;
    font-weight: 700;
    padding: .15rem 0 0;
    text-align: left;
}

.day-schedule {
    margin-bottom: 1rem;
}

.day-filter-grid {
    align-items: end;
    background: #f6f4ef;
    border: 1px solid #e0d9cc;
    border-radius: 8px;
    display: grid;
    gap: .75rem;
    grid-template-columns: minmax(170px, 1.2fr) minmax(150px, 1fr) repeat(2, minmax(120px, .75fr)) minmax(150px, 1fr) minmax(150px, 1fr) auto;
    margin-bottom: 1rem;
    padding: .85rem;
}

.day-filter-grid label {
    color: #4d4942;
    font-weight: 600;
}

.day-filter-grid .form-control,
.day-filter-grid .form-select {
    margin-top: .3rem;
}

.day-filter-actions {
    display: flex;
    justify-content: flex-end;
}

.section-header {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.section-header p {
    color: #6f6a61;
    margin: .25rem 0 0;
}

.alert {
    margin-bottom: 0;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

#blazor-error-ui {
    background: #fff0f0;
    border-top: 1px solid #d18a8a;
    bottom: 0;
    display: none;
    left: 0;
    padding: .75rem 1rem;
    position: fixed;
    right: 0;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
}

.connection-status {
    background: #842029;
    bottom: calc(4.15rem + env(safe-area-inset-bottom));
    color: #fff;
    display: none;
    font-size: .88rem;
    left: .75rem;
    padding: .65rem .8rem;
    position: fixed;
    right: .75rem;
    text-align: center;
    z-index: 990;
}

.connection-status.visible {
    display: block;
}

.reconnect-modal {
    align-items: center;
    background: #fff;
    border: 1px solid #d18a8a;
    bottom: calc(4.15rem + env(safe-area-inset-bottom));
    box-shadow: 0 8px 24px rgba(30, 25, 22, .16);
    display: flex;
    gap: .65rem;
    left: .75rem;
    padding: .75rem 1rem;
    position: fixed;
    right: .75rem;
    z-index: 995;
}

.reconnect-modal.components-reconnect-hide {
    display: none;
}

.reconnect-modal.components-reconnect-show .components-reconnect-failed,
.reconnect-modal.components-reconnect-show .components-reconnect-rejected,
.reconnect-modal.components-reconnect-failed .components-reconnect-show,
.reconnect-modal.components-reconnect-failed .components-reconnect-rejected,
.reconnect-modal.components-reconnect-rejected .components-reconnect-show,
.reconnect-modal.components-reconnect-rejected .components-reconnect-failed {
    display: none;
}

.mobile-appointment-controls,
.mobile-filter-summary,
.mobile-only,
.mobile-weekday {
    display: none;
}

@media (max-width: 900px) {
    html {
        scroll-padding-top: 4rem;
    }

    body {
        padding-bottom: calc(4.25rem + env(safe-area-inset-bottom));
    }

    h1 {
        font-size: 1.65rem;
    }

    h2 {
        font-size: 1.15rem;
    }

    section,
    .auth-panel {
        border-left: 0;
        border-radius: 0;
        border-right: 0;
        margin-bottom: .75rem;
        padding: 1rem;
    }

    .content {
        padding: 1rem 0 calc(1.5rem + env(safe-area-inset-bottom)) !important;
    }

    .content > .page-header,
    .content > .metric-grid,
    .content > .summary-band,
    .content > .alert,
    .content > .mobile-appointment-controls {
        margin-left: .75rem;
        margin-right: .75rem;
    }

    .page-header {
        align-items: stretch;
        flex-direction: column;
        gap: .75rem;
        margin-bottom: 1rem;
    }

    .page-header > .btn,
    .page-header > form,
    .page-header > form .btn,
    .page-header > .button-row {
        width: 100%;
    }

    .toolbar {
        align-items: stretch;
        display: grid;
        grid-template-columns: 1fr;
    }

    .toolbar .form-control {
        min-width: 0;
        width: 100%;
    }

    .form-control,
    .form-select,
    .btn {
        font-size: 1rem;
        min-height: 44px;
    }

    textarea.form-control {
        min-height: 7rem;
    }

    .form-grid,
    .form-grid.compact,
    .inline-form {
        grid-template-columns: minmax(0, 1fr);
    }

    .span-2 {
        grid-column: 1;
    }

    .service-options {
        grid-template-columns: 1fr;
    }

    .service-option {
        min-height: 46px;
    }

    .button-row {
        align-items: stretch;
        display: grid;
        grid-template-columns: 1fr;
    }

    .two-column,
    .two-column.wide-left {
        display: block;
    }

    .metric-grid,
    .summary-band,
    .info-grid {
        gap: .6rem;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .metric,
    .summary-band div,
    .info-grid div {
        padding: .8rem;
    }

    .metric strong,
    .summary-band strong,
    .info-grid strong {
        font-size: 1.12rem;
    }

    .list-row {
        align-items: stretch;
        flex-direction: column;
        gap: .65rem;
    }

    .list-row .actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        justify-content: stretch;
    }

    .list-row .actions .btn {
        width: 100%;
    }

    .timeline-head {
        flex-direction: column;
    }

    .timeline-head .actions {
        display: grid;
        gap: .4rem;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .timeline-head .actions .btn,
    .timeline-head .actions .btn-sm {
        width: 100%;
    }

    .timeline dl {
        grid-template-columns: 88px minmax(0, 1fr);
    }

    .table-wrap {
        max-width: 100%;
        overscroll-behavior-x: contain;
    }

    .mobile-card-table,
    .mobile-card-table tbody,
    .mobile-card-table tr,
    .mobile-card-table td {
        display: block;
        width: 100%;
    }

    .mobile-card-table thead {
        display: none;
    }

    .mobile-card-table tr {
        border: 1px solid #e0d9cc;
        border-radius: 8px;
        margin-bottom: .65rem;
        overflow: hidden;
    }

    .mobile-card-table td {
        align-items: start;
        border: 0;
        display: grid;
        gap: .65rem;
        grid-template-columns: minmax(80px, .8fr) minmax(0, 1.4fr);
        padding: .55rem .7rem;
        white-space: normal;
    }

    .mobile-card-table td::before {
        color: #6f6a61;
        content: attr(data-label);
        font-size: .78rem;
        font-weight: 700;
        padding-top: .12rem;
    }

    .mobile-card-table td.actions {
        display: grid;
        gap: .4rem;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mobile-card-table td.actions::before {
        display: none;
    }

    .mobile-card-table td.actions .btn {
        margin: 0;
        width: 100%;
    }

    .appointment-list-time {
        min-width: 0;
        white-space: normal;
    }

    .auth-panel {
        margin: 1.5rem .75rem;
        max-width: none;
    }

    .password-field {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .quick-time-slots {
        align-items: stretch;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .quick-time-slots strong {
        grid-column: 1 / -1;
    }

    .quick-time-slots .btn {
        min-width: 0;
        padding-left: .25rem;
        padding-right: .25rem;
    }

    .mobile-only,
    .mobile-appointment-controls {
        display: flex;
    }

    .mobile-appointment-controls {
        align-items: stretch;
        background: #fff;
        border: 1px solid #e0d9cc;
        border-radius: 8px;
        flex-direction: column;
        gap: .75rem;
        margin-bottom: .75rem;
        padding: .75rem;
    }

    .mobile-view-toggle,
    .mobile-date-navigation {
        display: grid;
        gap: .4rem;
    }

    .mobile-view-toggle {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mobile-date-navigation {
        grid-template-columns: 44px minmax(0, 1fr) 44px;
    }

    .mobile-today-button {
        width: 100%;
    }

    .desktop-calendar-toolbar {
        display: none;
    }

    .calendar-grid {
        gap: .2rem;
        grid-template-columns: repeat(7, minmax(0, 1fr));
        padding: .75rem;
    }

    .calendar-grid.mobile-day-active {
        display: none;
    }

    .calendar-weekday {
        border-radius: 4px;
        font-size: 0;
        padding: .35rem .1rem;
    }

    .desktop-weekday {
        display: none;
    }

    .mobile-weekday {
        display: inline;
        font-size: .68rem;
    }

    .calendar-day {
        border-radius: 5px;
        height: 58px;
        padding: .3rem;
    }

    .calendar-day-header strong {
        font-size: .9rem;
    }

    .calendar-day-header span {
        font-size: .65rem;
        min-width: 1.15rem;
        padding: .05rem .2rem;
    }

    .calendar-items-preview,
    .calendar-more {
        display: none;
    }

    .day-schedule.mobile-month-active {
        display: none;
    }

    .section-header {
        align-items: stretch;
        flex-direction: column;
    }

    .section-header .btn {
        width: 100%;
    }

    .mobile-filter-summary {
        align-items: center;
        color: #7b3f54;
        cursor: pointer;
        display: flex;
        font-weight: 700;
        justify-content: space-between;
        min-height: 44px;
        padding: .25rem 0;
    }

    details.mobile-filter-panel[open] .mobile-filter-summary {
        margin-bottom: .5rem;
    }

    details.mobile-filter-panel:not([open]) {
        border-bottom: 1px solid #e0d9cc;
        margin-bottom: .75rem;
    }

    .mobile-quick-time-panel {
        border-bottom: 1px solid #e0d9cc;
        margin-bottom: .75rem;
    }

    .mobile-quick-time-panel[open] {
        border-bottom: 0;
    }

    .appointment-month-list {
        display: none;
    }

    .day-filter-grid {
        grid-template-columns: 1fr;
        padding: .75rem;
    }

    .day-filter-actions .btn {
        width: 100%;
    }

    #appointment-form .button-row,
    .mobile-sticky-actions {
        background: #fff;
        bottom: calc(4.2rem + env(safe-area-inset-bottom));
        border-top: 1px solid #e0d9cc;
        margin: .25rem -1rem -1rem;
        padding: .65rem 1rem;
        position: sticky;
        z-index: 15;
    }

    .dashboard-today-appointments {
        max-height: 24rem;
    }

    .reconnect-modal,
    .connection-status {
        align-items: stretch;
        bottom: calc(4.35rem + env(safe-area-inset-bottom));
        flex-direction: column;
    }
}

@media (min-width: 901px) {
    .mobile-filter-panel > summary,
    .mobile-quick-time-panel > summary {
        display: none;
    }

    .mobile-quick-time-panel:not([open]) > .quick-time-slots {
        display: flex;
    }
}

@media print {
    .sidebar, .top-row, .print-hide {
        display: none !important;
    }

    .content {
        padding: 0;
    }

    section, .metric, .summary-band div {
        break-inside: avoid;
        border-color: #bbb;
    }
}
