:root {
    --bg: #f7f3ef;
    --surface: #ffffff;
    --text: #2c2825;
    --muted: #6f6760;
    --line: #e6ddd4;
    --accent: #8b5e3c;
    --accent-soft: #f0e4d8;
    --danger: #b42318;
    --radius: 12px;
    --shadow: 0 8px 24px rgba(44, 40, 37, 0.08);
    --font: "Manrope", "Segoe UI", system-ui, sans-serif;
    --font-title: Georgia, "Times New Roman", serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.45;
}

img {
    max-width: 100%;
    display: block;
}

button,
input,
select {
    font: inherit;
}

.app-shell {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px 16px 32px;
}

.app-header {
    margin-bottom: 20px;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.app-brand-text {
    min-width: 0;
    flex: 1 1 auto;
}

.studio-logo {
    display: block;
    flex: 0 0 auto;
    max-height: 64px;
    max-width: min(96px, 28vw);
    width: auto;
    height: auto;
    object-fit: contain;
}

.app-title {
    margin: 0 0 4px;
    font-family: var(--font-title);
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.2;
}

.app-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.app-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px 12px;
    margin-top: 12px;
}

.masters-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    flex: 1 1 220px;
    min-width: 0;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 140px;
    min-width: 120px;
    max-width: 260px;
}

.filter-dropdown {
    position: relative;
}

.filter-label {
    font-size: 0.75rem;
    color: var(--muted);
    line-height: 1.2;
}

.filter-select,
.filter-select-btn {
    appearance: none;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    padding: 10px 36px 10px 14px;
    font: inherit;
    cursor: pointer;
    text-align: left;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

.filter-select:focus,
.filter-select-btn:focus {
    outline: none;
    border-color: var(--accent);
}

.filter-dropdown.is-open .filter-select-btn {
    border-color: var(--accent);
}

.filter-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 20;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 10px 28px rgba(40, 28, 18, 0.12);
    max-height: min(260px, 50vh);
    overflow: auto;
}

.filter-menu-item {
    padding: 10px 14px;
    border-radius: 999px;
    cursor: pointer;
    color: var(--text);
    line-height: 1.25;
}

.filter-menu-item:hover,
.filter-menu-item:focus {
    background: var(--accent-soft);
    outline: none;
}

.filter-menu-item.is-active {
    background: var(--accent-soft);
    font-weight: 600;
}

.btn {
    appearance: none;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    border-radius: 999px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
    background: var(--accent-soft);
    border-color: #d8c8b8;
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: #744c30;
    border-color: #744c30;
}

.btn-ghost {
    background: transparent;
}

.btn-danger {
    background: #fff5f5;
    border-color: #f1c7c3;
    color: var(--danger);
}

.section-title {
    margin: 0 0 12px;
    font-family: var(--font-title);
    font-size: 1.15rem;
}

.masters-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

@media (min-width: 480px) {
    .masters-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.master-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    text-align: left;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.master-card:hover,
.master-card:focus-visible {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    outline: none;
}

.master-photo {
    aspect-ratio: 1;
    width: 100%;
    object-fit: cover;
    background: linear-gradient(145deg, #efe5db, #f8f4ef);
}

.master-photo.placeholder {
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 2rem;
}

.master-name {
    display: block;
    padding: 10px 12px 12px;
    font-weight: 600;
    font-size: 0.95rem;
}

.master-type {
    display: block;
    margin-top: -8px;
    padding: 0 12px 12px;
    color: var(--muted);
    font-size: 0.78rem;
}

.field {
    margin-bottom: 14px;
}

.field-date-asap {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px 10px;
}

.field-date-asap label {
    flex: 1 0 100%;
}

.field-date-asap input[type="date"] {
    flex: 1 1 160px;
    min-width: 0;
}

.asap-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

.field label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.88rem;
    color: var(--muted);
}

.field input,
.field select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 11px 12px;
    background: #fff;
}

.services-list {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.service-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.service-item input {
    margin-top: 0;
    flex-shrink: 0;
}

.service-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.service-name {
    font-weight: 600;
}

.service-duration,
.service-price {
    color: var(--muted);
    font-size: 0.88rem;
}

.service-amount {
    flex-shrink: 0;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    margin-left: auto;
}

.order-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin: 0 0 16px;
    padding: 10px 4px 0;
    font-size: 0.95rem;
    color: var(--muted);
}

.order-total-values {
    color: var(--text);
    text-align: right;
}

.order-total-values strong {
    font-weight: 700;
}

.slots-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.slot-chip {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 999px;
    padding: 8px 14px;
    cursor: pointer;
}

.slot-chip.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.slot-chip--busy,
.slot-chip:disabled {
    background: var(--bg);
    border-color: transparent;
    color: var(--muted);
    opacity: 0.55;
    cursor: default;
    pointer-events: none;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.notice {
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--accent-soft);
    border: 1px solid #dcc9b8;
    margin-bottom: 14px;
}

.notice-error {
    background: #fff5f5;
    border-color: #f1c7c3;
    color: var(--danger);
}

.empty {
    color: var(--muted);
    text-align: center;
    padding: 24px 12px;
}

.loader {
    text-align: center;
    padding: 48px 16px;
    color: var(--muted);
}

.confirm-box {
    text-align: center;
}

.confirm-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: #e8f5ea;
    color: #2f6b3a;
    display: grid;
    place-items: center;
    font-size: 1.6rem;
}

.booking-row {
    display: grid;
    gap: 4px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.booking-row:last-child {
    border-bottom: 0;
}

.booking-row-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
}

.booking-status {
    font-size: 0.82rem;
    color: var(--muted);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    color: var(--accent);
    text-decoration: none;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    font: inherit;
}

.hidden {
    display: none !important;
}

.zapis-powered {
    margin: 1.5rem 0 0.5rem;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--muted);
}

.zapis-powered a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}
