:root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-elevated: #ffffff;
    --header-height: 0px;
    --text: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-light: #dbeafe;
    --success: #10b981;
    --success-hover: #059669;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --shadow-subtle: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-medium: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-button: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    font-size: 14px;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

.sticky-shell {
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--bg);
    padding-top: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    overflow: visible;
    isolation: isolate;
    --sticky-shell-height: 0px;
}

.sticky-shell::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 24px;
    background: linear-gradient(to bottom, rgba(248, 250, 252, 0), rgba(248, 250, 252, 0.85));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    pointer-events: none;
    opacity: var(--header-fade, 0);
    transition: opacity 0.15s ease-out;
}

.header-fade {
    display: none;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 0;
    border-bottom: none;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-slot {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: linear-gradient(135deg, var(--surface) 0%, var(--border-light) 100%);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    overflow: hidden;
    box-shadow: var(--shadow-subtle);
    padding: 6px;
}

.logo-slot img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 1px 2px rgba(15, 23, 42, 0.12));
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.subtitle-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 13px;
}

.subtitle-label {
    font-weight: 500;
}

h1 {
    margin: 0;
    font-size: 36px;
    font-weight: 300;
    letter-spacing: -0.8px;
    color: var(--text);
    background: linear-gradient(135deg, var(--text) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.subtitle {
    margin: 8px 0 0;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 400;
    max-width: 500px;
    line-height: 1.5;
}

.header-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    position: relative;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-subtle);
}

.header-menu {
    position: absolute;
    right: 0;
    top: 48px;
    display: grid;
    gap: 10px;
    padding: 12px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    min-width: 180px;
    z-index: 500;
}

.header-menu {
    display: none;
}

.header-menu.is-open {
    display: grid;
}

.header-menu .btn {
    width: 100%;
    justify-content: center;
    white-space: nowrap;
}

.info-pop {
    position: relative;
}

.info-pop summary {
    list-style: none;
    cursor: pointer;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--surface);
}

.info-pop summary::-webkit-details-marker {
    display: none;
}

.info-icon {
    width: 14px;
    height: 14px;
    display: inline-block;
    border-radius: 50%;
    border: 2px solid currentColor;
    position: relative;
    color: var(--text-secondary);
}

.info-icon::before {
    content: '';
    position: absolute;
    width: 2px;
    height: 6px;
    background: currentColor;
    left: 50%;
    top: 5px;
    transform: translateX(-50%);
    border-radius: 2px;
}

.info-icon::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 2px;
    background: currentColor;
    left: 50%;
    top: 2px;
    transform: translateX(-50%);
    border-radius: 50%;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.info-pop div {
    position: absolute;
    right: 0;
    top: 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    width: min(320px, 80vw);
    color: var(--text-secondary);
    font-size: 12px;
    box-shadow: var(--shadow-soft);
    z-index: 30;
}

.info-inline div {
    right: auto;
    left: 0;
}

.sticky-bar {
    position: static;
    backdrop-filter: blur(10px);
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 10px 16px;
    margin: 0;
    box-shadow: var(--shadow-subtle);
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 100%;
    transition: box-shadow 0.25s ease;
}

.jump-links {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 0;
    padding-top: 6px;
    border-top: 1px solid var(--border-light);
}

.jump-links a {
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2px;
    transition: all 0.2s ease;
}

.jump-links a:hover {
    color: var(--accent);
    border-color: var(--accent-light);
    background: var(--accent-light);
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-subtle);
    padding: 32px;
    margin-bottom: 24px;
    scroll-margin-top: calc(var(--sticky-shell-height, 0px) + 16px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-light), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-medium);
    transform: translateY(-2px);
    border-color: var(--accent-light);
}

.card:hover::before {
    opacity: 1;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.counter-trigger {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    background: transparent;
    color: var(--accent);
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.counter-cell {
    width: 40px;
    text-align: center;
    vertical-align: middle;
}

.area-counter-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--accent);
    background: transparent;
    color: var(--accent);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    padding: 0;
    line-height: 1;
}

.area-name {
    text-align: left;
}

.counter-trigger:hover {
    background: var(--accent);
    color: #fff;
    transform: scale(1.1);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.3px;
    color: var(--text);
    margin: 0;
}
.card-note {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 400;
}
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: var(--radius);
    background: var(--bg);
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

/* Global Service Toggle */
.global-service-toggle {
    display: flex;
    gap: 16px;
    margin-bottom: 0;
    justify-content: center;
    background: var(--border-light);
    padding: 6px;
    border-radius: var(--radius-lg);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.global-service-btn {
    flex: 1;
    padding: 14px 24px;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    font-family: "Open Sans", sans-serif;
    font-weight: 600;
    font-size: 15px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.global-service-btn.active {
    background: var(--surface);
    color: var(--accent);
    box-shadow: var(--shadow-soft);
    transform: translateY(-1px);
}

.global-service-btn:hover:not(.active) {
    color: var(--text);
}

.service-content {
    display: none;
}

.service-content.active {
    display: block;
}

/* Compact Table Layout */
.compact-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.compact-table th {
    text-align: left;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    background: var(--bg);
    font-family: "Open Sans", sans-serif;
    letter-spacing: 0.3px;
}

.compact-table th:not(:first-child) {
    text-align: center;
}

.compact-table th:first-child {
    border-radius: var(--radius-sm) 0 0 0;
}

.compact-table th:last-child {
    border-radius: 0 var(--radius-sm) 0 0;
}

.compact-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.compact-table tr:hover td {
    background: var(--accent-light);
}

.area-name {
    font-weight: 600;
    color: var(--text);
    font-size: 14px;
}

.input-cell {
    text-align: center;
}

.compact-input {
    text-align: center;
}

.compact-input {
    width: 80px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center !important;
    font-family: "Open Sans", sans-serif;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--surface);
}

.compact-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
}

.compact-input.readonly {
    background: var(--bg);
    color: var(--accent);
    font-weight: 700;
    border-color: var(--accent);
    text-align: center !important;
}

.total-row {
    background: var(--bg);
    font-weight: 700;
}

.total-row td {
    border-top: 2px solid var(--accent);
    border-bottom: none;
    color: var(--accent);
    font-size: 15px;
}

.total-row .area-name {
    color: var(--text);
}

/* Additional table improvements */
.compact-table {
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-subtle);
}

.compact-table thead {
    background: linear-gradient(135deg, var(--bg) 0%, var(--border-light) 100%);
}

.compact-table tbody tr:last-child td {
    border-bottom: none;
}

/* Mobile optimization */
@media (max-width: 768px) {
    .container { 
        padding: 16px 12px; 
        max-width: 100%;
    }
    .page-header {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
        gap: 8px;
        margin-bottom: 8px;
    }
    .sticky-shell {
        position: sticky;
        top: 0;
        padding-top: 4px;
        padding-bottom: 6px;
        z-index: 100;
    }
    .header-brand {
        align-items: center;
        gap: 8px;
        flex: 1;
        min-width: 0;
    }
    .logo-slot {
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }
    h1 {
        font-size: 14px;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .subtitle-row {
        display: none;
    }
    .header-actions {
        flex-shrink: 0;
        align-self: flex-start;
    }
    .icon-btn {
        width: 32px;
        height: 32px;
        font-size: 18px;
        padding: 0;
    }
    .info-pop div {
        width: min(280px, 90vw);
    }
    .header-menu {
        right: 8px;
        top: 44px;
        z-index: 200;
        max-height: 50vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        width: calc(100% - 16px);
        max-width: 280px;
    }
    .header-menu .btn {
        white-space: nowrap;
        width: 100%;
        justify-content: center;
    }
    .card {
        padding: 16px;
        margin-bottom: 12px;
        overflow-x: hidden;
    }
    .card-header {
        margin-bottom: 16px;
        padding-bottom: 12px;
    }
    .card-title {
        font-size: 16px;
    }
    .counter-trigger {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
    .form-grid { grid-template-columns: 1fr; }
    .summary-grid { grid-template-columns: 1fr; }
    .summary-card {
        overflow: hidden;
        border-radius: var(--radius-sm);
    }
    .btn { 
        min-width: 0; 
        flex: 1 1 45%; 
        padding: 10px 8px;
        font-size: 12px;
    }
    
    .btn-row {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin: 12px 0;
    }
    
    .btn-row .btn {
        min-width: 0;
        flex: 1 1 calc(50% - 4px);
        white-space: nowrap;
    }
    
    .report-controls {
        display: flex !important;
        flex-direction: column;
        gap: 8px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .report-field,
    .report-actions {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .report-field select {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .report-actions {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .report-actions .btn {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
        white-space: nowrap;
    }
    
    textarea {
        width: 100%;
        max-width: 100%;
        font-size: 12px;
        min-height: 100px;
        padding: 10px;
        box-sizing: border-box;
    }

    /* Responsive table layout - fit without horizontal scroll */
    .compact-table {
        display: table;
        width: 100%;
        table-layout: fixed;
    }
    
    .compact-table thead {
        display: table-header-group;
    }
    
    .compact-table tbody {
        display: table-row-group;
    }
    
    .compact-table tr {
        display: table-row;
    }
    
    .compact-table th,
    .compact-table td {
        padding: 6px 4px;
        font-size: 12px;
        text-align: center;
        width: 25%;
        overflow: hidden;
        box-sizing: border-box;
    }
    
    .compact-table th:first-child,
    .compact-table td:first-child {
        width: 25%;
        text-align: left;
    }
    
    .compact-input {
        width: 100%;
        min-width: 40px;
        max-width: 50px;
        padding: 4px 2px;
        font-size: 12px;
        box-sizing: border-box;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .area-name {
        font-size: 11px;
        padding: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 80px;
    }
    
    .input-cell {
        padding: 4px 2px !important;
        overflow: hidden;
    }

    /* Global service toggle mobile */
    .global-service-toggle {
        flex-direction: row;
        gap: 6px;
        margin-bottom: 8px;
        padding: 6px;
    }

    .global-service-btn {
        width: auto;
        flex: 1;
        padding: 8px 8px;
        font-size: 12px;
    }
    
    .sticky-bar {
        position: sticky;
        top: 0;
        padding: 8px 10px;
        gap: 6px;
        z-index: 99;
    }
    
    .jump-links {
        gap: 4px;
        padding-top: 4px;
    }
    
    .jump-links a {
        padding: 4px 8px;
        font-size: 11px;
    }
    .page-footer {
        flex-direction: column;
        align-items: flex-start;
    }
}

.compact-input {
    width: 60px;
    padding: 4px 6px;
    font-size: 12px;
}

.area-name {
    font-size: 12px;
}

.entry-label {
    display: flex;
    align-items: center;
    font-weight: 500;
    color: var(--text);
    font-size: 14px;
}

.services {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.service {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    background: var(--surface);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.service::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--accent-light);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: var(--radius);
    pointer-events: none;
}

.service:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-soft);
    transform: translateY(-1px);
}

.service:hover::before {
    opacity: 0.5;
}

.service-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.service-time {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    letter-spacing: -0.2px;
}
.service-legend {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 400;
}

.counts {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.mini-field {
    display: grid;
    grid-template-columns: 24px 1fr;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
}

.mini-key {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    text-align: center;
    letter-spacing: 0.5px;
}

input[type="number"] {
    width: 100%;
    border: none;
    outline: none;
    font-size: 14px;
    text-align: center !important;
    padding: 0;
    background: transparent;
    color: var(--text);
    font-family: "Open Sans", sans-serif;
    font-weight: 600;
    transition: color 0.2s ease;
}

input[type="number"]:focus {
    color: var(--accent);
}

.mini-field:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
}

.mini-field:focus-within .mini-key {
    color: var(--accent);
}

.is-total .service {
    background: var(--surface);
    border-color: var(--accent);
}
.is-total input[readonly] {
    color: var(--accent);
    font-weight: 600;
}

.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.summary-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    background: var(--surface);
}
.summary-title {
    font-weight: 500;
    margin-bottom: 16px;
    font-size: 16px;
    color: var(--text);
}
.summary-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 14px;
}
.summary-line:last-child { border-bottom: none; }
.summary-line strong {
    color: var(--text);
    font-weight: 500;
}
.summary-line .value {
    min-width: 60px;
    text-align: right;
    font-weight: 600;
    color: var(--text);
    font-family: "Helvetica Neue", monospace;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.report-controls {
    display: grid;
    grid-template-columns: minmax(200px, 1fr) auto;
    gap: 16px;
    align-items: end;
    margin-bottom: 16px;
}

.report-field label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text);
}

.report-field select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    background: var(--surface);
    font-size: 14px;
    font-family: "Open Sans", sans-serif;
    color: var(--text);
}

.report-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.report-status {
    grid-column: 1 / -1;
    font-size: 12px;
    color: var(--text-secondary);
    min-height: 16px;
}
.field {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    background: var(--surface);
    transition: border-color 0.2s ease;
}
.field label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text);
}
.field input[type="number"] {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    width: 100%;
    text-align: left;
    background: var(--surface);
    font-size: 14px;
    transition: all 0.2s ease;
}
.field input[type="number"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.btn-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin: 24px 0;
}
.btn {
    appearance: none;
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 12px 24px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
    min-width: 140px;
    text-align: center;
    position: relative;
    overflow: hidden;
    font-family: "Open Sans", sans-serif;
    letter-spacing: 0.3px;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:active {
    transform: translateY(1px) scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: #fff;
    border-color: var(--accent);
    box-shadow: var(--shadow-button);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-hover) 0%, #1d4ed8 100%);
    box-shadow: var(--shadow-soft);
    transform: translateY(-2px);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--text) 0%, #334155 100%);
    color: #fff;
    border-color: var(--text);
    box-shadow: var(--shadow-button);
}
.btn-secondary:hover {
    background: linear-gradient(135deg, #334155 0%, #475569 100%);
    box-shadow: var(--shadow-soft);
    transform: translateY(-2px);
}

.btn-ghost {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
    box-shadow: var(--shadow-subtle);
}
.btn-ghost:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: var(--shadow-button);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, var(--danger-hover) 100%);
    color: #fff;
    border-color: var(--danger);
    box-shadow: var(--shadow-button);
}
.btn-danger:hover {
    background: linear-gradient(135deg, var(--danger-hover) 0%, #b91c1c 100%);
    box-shadow: var(--shadow-soft);
    transform: translateY(-2px);
}

textarea {
    width: 100%;
    height: 240px;
    resize: vertical;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 16px;
    font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.6;
    background: var(--surface);
    transition: all 0.2s ease;
}
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.toast {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 32px;
    background: linear-gradient(135deg, var(--text) 0%, #334155 100%);
    color: #fff;
    padding: 14px 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-medium);
    font-weight: 600;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: "Open Sans", sans-serif;
    letter-spacing: 0.3px;
    backdrop-filter: blur(10px);
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(-12px);
}

/* Counter Modal */
.counter-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.counter-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

.counter-panel-full {
    position: relative;
    background: var(--surface);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-medium);
    animation: counterSlideIn 0.2s ease;
}

@keyframes counterSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.counter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.counter-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
}

.counter-header .counter-service-badge {
    background: var(--accent);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.counter-close {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg);
    border-radius: 50%;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.counter-close:hover {
    background: var(--danger);
    color: #fff;
}

.counter-area-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px 24px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.counter-nav-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--text);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.counter-nav-btn:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

.counter-area-select {
    flex: 1;
    max-width: 220px;
    padding: 12px 36px 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 17px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

.counter-area-select:focus {
    outline: none;
    border-color: var(--accent);
}

.counter-content-full {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 32px 24px;
    gap: 28px;
    overflow-y: auto;
}

.counter-category {
    width: 100%;
    max-width: 400px;
}

.counter-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 14px;
    text-align: center;
}

.counter-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
}

.counter-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: none;
    font-size: 36px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.counter-btn.minus {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.35);
}

.counter-btn.minus:hover {
    background: var(--danger-hover);
    transform: scale(1.08);
}

.counter-btn.minus:active {
    transform: scale(0.95);
}

.counter-btn.plus {
    background: var(--success);
    color: #fff;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
}

.counter-btn.plus:hover {
    background: var(--success-hover);
    transform: scale(1.08);
}

.counter-btn.plus:active {
    transform: scale(0.95);
}

.counter-value {
    font-size: 52px;
    font-weight: 700;
    color: var(--text);
    min-width: 110px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.counter-totals {
    text-align: center;
    padding: 14px;
    background: var(--accent-light);
    font-size: 18px;
    font-weight: 600;
    color: var(--accent);
}

.counter-actions-full {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.counter-actions-full .btn {
    flex: 1;
    padding: 14px;
    font-size: 15px;
}

/* Theme overrides */
body[data-theme="dark"] {
    --bg: #0f172a;
    --surface: #111827;
    --surface-elevated: #1f2937;
    --text: #e5e7eb;
    --text-secondary: #cbd5f5;
    --text-muted: #94a3b8;
    --border: #1f2937;
    --border-light: #0b1220;
    --accent-light: rgba(59, 130, 246, 0.18);
    --shadow-subtle: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-soft: 0 6px 12px rgba(0, 0, 0, 0.35);
    --shadow-medium: 0 18px 28px rgba(0, 0, 0, 0.45);
    --shadow-button: 0 2px 6px rgba(0, 0, 0, 0.35);
}
body[data-theme="dark"] .btn-ghost {
    background: #0b1220;
    border-color: #1f2937;
    color: var(--text);
}
body[data-theme="dark"] .btn-ghost:hover {
    background: #111827;
    border-color: #334155;
    color: #e2e8f0;
}
body[data-theme="dark"] .compact-table th {
    background: var(--surface-elevated);
}
body[data-theme="dark"] .compact-input.readonly {
    background: var(--surface-elevated);
}
body[data-theme="dark"] textarea {
    color: var(--text);
}
body[data-theme="dark"] .jump-links a {
    color: var(--text);
}
body[data-theme="dark"] .jump-links a:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: #334155;
    color: #e2e8f0;
}
body[data-theme="dark"] .global-service-toggle {
    background: rgba(15, 23, 42, 0.9);
    border-color: #1f2937;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}
body[data-theme="dark"] .sticky-bar {
    background: rgba(15, 23, 42, 0.92);
    border-color: rgba(148, 163, 184, 0.2);
    box-shadow: var(--shadow-subtle);
}
body[data-theme="dark"] .header-fade {
    background: linear-gradient(to bottom, transparent, rgba(15, 23, 42, 0.95));
}
body[data-theme="dark"] .sticky-bar.is-compact {
    box-shadow: var(--shadow-soft);
}
body[data-theme="dark"] .jump-links {
    border-top-color: rgba(148, 163, 184, 0.2);
}

@media (prefers-color-scheme: dark) {
    body:not([data-theme]) {
        --bg: #0f172a;
        --surface: #111827;
        --surface-elevated: #1f2937;
        --text: #e5e7eb;
        --text-secondary: #cbd5f5;
        --text-muted: #94a3b8;
        --border: #1f2937;
        --border-light: #0b1220;
        --accent-light: rgba(59, 130, 246, 0.18);
        --shadow-subtle: 0 1px 2px rgba(0, 0, 0, 0.35);
        --shadow-soft: 0 6px 12px rgba(0, 0, 0, 0.35);
        --shadow-medium: 0 18px 28px rgba(0, 0, 0, 0.45);
        --shadow-button: 0 2px 6px rgba(0, 0, 0, 0.35);
    }
    body:not([data-theme]) .btn-ghost {
        background: #0b1220;
        border-color: #1f2937;
        color: var(--text);
    }
    body:not([data-theme]) .btn-ghost:hover {
        background: #111827;
        border-color: #334155;
        color: #e2e8f0;
    }
    body:not([data-theme]) .compact-table th {
        background: var(--surface-elevated);
    }
    body:not([data-theme]) .compact-input.readonly {
        background: var(--surface-elevated);
    }
    body:not([data-theme]) textarea {
        color: var(--text);
    }
    body:not([data-theme]) .global-service-toggle {
        background: rgba(15, 23, 42, 0.9);
        border-color: #1f2937;
        box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
    }
    body:not([data-theme]) .jump-links a {
        color: var(--text);
    }
    body:not([data-theme]) .jump-links a:hover {
        background: rgba(59, 130, 246, 0.15);
        border-color: #334155;
        color: #e2e8f0;
    }
    body:not([data-theme]) .sticky-bar {
        background: rgba(15, 23, 42, 0.92);
        border-color: rgba(148, 163, 184, 0.2);
        box-shadow: var(--shadow-subtle);
    }
    body:not([data-theme]) .sticky-shell::after {
        background: linear-gradient(to bottom, rgba(15, 23, 42, 0), rgba(15, 23, 42, 0.9));
    }
    body:not([data-theme]) .sticky-bar.is-compact {
        box-shadow: var(--shadow-soft);
    }
    body:not([data-theme]) .jump-links {
        border-top-color: rgba(148, 163, 184, 0.2);
    }
}

/* Calendar Styles */
.calendar-picker {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.calendar-header span {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.calendar-header > div {
    display: flex;
    gap: 8px;
}

.cal-nav {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.cal-nav:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

.cal-today {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cal-today:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.cal-day-header {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.cal-day:hover:not(.cal-day-disabled):not(.selected) {
    border-color: var(--accent);
    background: var(--accent-light);
}

.cal-day.selected {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    font-weight: 600;
}

.cal-day.has-data {
    background: rgba(16, 185, 129, 0.15);
    border-color: var(--success);
    color: var(--success);
    font-weight: 600;
}

.cal-day.has-data.selected {
    background: var(--accent);
    color: #fff;
}

.cal-day-empty {
    background: transparent;
    border-color: transparent;
    cursor: default;
}

.cal-day-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--bg);
}

.cal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.cal-actions .btn {
    min-width: 120px;
}

/* Calendar dark mode */
body[data-theme="dark"] .calendar-picker {
    background: var(--surface);
    border-color: var(--border);
}

body[data-theme="dark"] .calendar-header {
    border-color: var(--border);
}

body[data-theme="dark"] .calendar-header span {
    color: var(--text);
}

body[data-theme="dark"] .cal-nav {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

body[data-theme="dark"] .cal-nav:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

body[data-theme="dark"] .cal-today {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text-secondary);
}

body[data-theme="dark"] .cal-today:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

body[data-theme="dark"] .cal-day-header {
    color: var(--text-secondary);
}

body[data-theme="dark"] .cal-day {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

body[data-theme="dark"] .cal-day-disabled {
    background: var(--bg);
    opacity: 0.3;
}

body[data-theme="dark"] .cal-day-empty {
    background: transparent;
}

body[data-theme="dark"] .cal-day.has-data {
    background: rgba(16, 185, 129, 0.25);
    border-color: #10b981;
    color: #10b981;
}

body[data-theme="dark"] .cal-day.has-data.selected {
    background: var(--accent);
    color: #fff;
}

body[data-theme="dark"] .cal-actions {
    border-color: var(--border);
}

/* Calendar system dark mode */
@media (prefers-color-scheme: dark) {
    body:not([data-theme]) .calendar-picker {
        background: var(--surface);
        border-color: var(--border);
    }
    
    body:not([data-theme]) .calendar-header {
        border-color: var(--border);
    }
    
    body:not([data-theme]) .calendar-header span {
        color: var(--text);
    }
    
    body:not([data-theme]) .cal-nav {
        background: var(--surface);
        border-color: var(--border);
        color: var(--text);
    }
    
    body:not([data-theme]) .cal-nav:hover {
        background: var(--accent-light);
        border-color: var(--accent);
        color: var(--accent);
    }
    
    body:not([data-theme]) .cal-today {
        background: var(--surface);
        border-color: var(--border);
        color: var(--text-secondary);
    }
    
    body:not([data-theme]) .cal-today:hover {
        background: var(--accent-light);
        border-color: var(--accent);
        color: var(--accent);
    }
    
    body:not([data-theme]) .cal-day-header {
        color: var(--text-secondary);
    }
    
    body:not([data-theme]) .cal-day {
        background: var(--surface);
        border-color: var(--border);
        color: var(--text);
    }
    
    body:not([data-theme]) .cal-day-disabled {
        background: var(--bg);
        opacity: 0.3;
    }
    
    body:not([data-theme]) .cal-day-empty {
        background: transparent;
    }
    
    body:not([data-theme]) .cal-day.has-data {
        background: rgba(16, 185, 129, 0.25);
        border-color: #10b981;
        color: #10b981;
    }
    
    body:not([data-theme]) .cal-day.has-data.selected {
        background: var(--accent);
        color: #fff;
    }
    
    body:not([data-theme]) .cal-actions {
        border-color: var(--border);
    }
}

/* Confirm Modal */
.confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.confirm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.confirm-panel {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-medium);
}

.confirm-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
}

.confirm-message {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.confirm-actions .btn {
    min-width: 100px;
}

/* Confirm Modal Dark Mode */
body[data-theme="dark"] .confirm-panel {
    background: var(--surface);
    border-color: var(--border);
}

body[data-theme="dark"] .confirm-backdrop {
    background: rgba(0, 0, 0, 0.7);
}

@media (prefers-color-scheme: dark) {
    body:not([data-theme]) .confirm-panel {
        background: var(--surface);
        border-color: var(--border);
    }
    
    body:not([data-theme]) .confirm-backdrop {
        background: rgba(0, 0, 0, 0.7);
    }
}

/* Scroll to Top Button */
.scroll-top-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-top-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    transform: translateY(-2px);
}

body[data-theme="dark"] .scroll-top-btn {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

@media (prefers-color-scheme: dark) {
    body:not([data-theme]) .scroll-top-btn {
        background: var(--surface);
        border-color: var(--border);
        color: var(--text);
    }
}