:root {
    --brand: #003E7E;
    --brand-dark: #002855;
    --brand-light: #0090E0;
    --brand-soft: #e8f4fd;
    --brand-glow: rgba(0, 144, 224, 0.2);
    --topbar-bg: #003E7E;
    --sidebar-bg: #ffffff;
    --accent: #003E7E;
    --accent-hover: #002855;
    --accent-secondary: #0090E0;
    --selected-bg: #e8f4fd;
    --border: #e8ecf2;
    --border-strong: #d5dbe6;
    --text: #1a1d26;
    --muted: #64748b;
    --white: #ffffff;
    --danger: #dc2626;
    --success: #059669;
    --shadow-sm: 0 1px 2px rgba(26, 29, 38, 0.04);
    --shadow: 0 8px 24px rgba(26, 29, 38, 0.08);
    --shadow-lg: 0 20px 48px rgba(26, 29, 38, 0.12);
    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --z-topbar: 100;
    --z-sidebar: 500;
    --z-overlay: 450;
    --z-sheet: 800;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    color: var(--text);
    background: #f4f6fb;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 12% 18%, rgba(0, 62, 126, 0.08) 0%, transparent 42%),
        radial-gradient(circle at 88% 12%, rgba(0, 144, 224, 0.07) 0%, transparent 38%),
        radial-gradient(circle at 70% 88%, rgba(0, 62, 126, 0.05) 0%, transparent 40%),
        linear-gradient(180deg, #f8f9fc 0%, #eef2f8 100%);
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(420px, 80vw);
    height: min(260px, 38vh);
    background: url('LOGO.png') center center / contain no-repeat;
    opacity: 0.035;
    pointer-events: none;
    z-index: 0;
}

.app-shell,
.login-page,
.worker-shell {
    position: relative;
    z-index: 1;
}

a {
    color: var(--accent);
    text-decoration: none;
}

.app-shell {
    min-height: 100vh;
    display: flex;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

.sidebar {
    width: 248px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    z-index: 30;
    box-shadow: var(--shadow-sm);
}

.sidebar-brand {
    padding: 20px 18px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-brand-logo {
    width: 100%;
    max-width: 168px;
    height: auto;
    display: block;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 2px 10px;
    padding: 11px 14px;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border-left: none;
    transition: background var(--transition), color var(--transition), transform var(--transition);
}

.sidebar-link:hover {
    background: var(--brand-soft);
    color: var(--brand-dark);
}

.sidebar-link.is-active {
    background: linear-gradient(135deg, var(--brand-soft) 0%, #fff 100%);
    color: var(--brand);
    font-weight: 600;
}

.sidebar-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f3f5f9;
    color: var(--muted);
    flex-shrink: 0;
    transition: background var(--transition), color var(--transition);
}

.sidebar-icon i {
    font-size: 14px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 25;
}

.sidebar-overlay.is-open {
    display: block;
}

.topbar {
    background: var(--topbar-bg);
    color: var(--white);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 22px;
    height: 60px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: var(--z-topbar);
    box-shadow: 0 4px 20px rgba(0, 40, 85, 0.24);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.sidebar-toggle {
    display: none;
    background: transparent;
    border: 0;
    color: var(--white);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
}

.topbar-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-search-spacer {
    flex: 1;
}

.topbar-search {
    flex: 1;
    max-width: 320px;
    position: relative;
}

.topbar-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 12px;
    pointer-events: none;
}

.topbar-search input {
    width: 100%;
    border: 0;
    border-radius: 999px;
    padding: 9px 14px 9px 36px;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.16);
    color: var(--white);
    backdrop-filter: blur(6px);
}

.topbar-search input::placeholder {
    color: rgba(255, 255, 255, 0.72);
}

.topbar-search input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.24);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.18);
}

.topbar-search-icon {
    color: rgba(255, 255, 255, 0.8);
}

.topbar-actions {
    margin-left: auto;
    flex-shrink: 0;
}

.topbar-link {
    color: var(--white);
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    transition: background var(--transition);
}

.topbar-link:hover {
    background: rgba(255, 255, 255, 0.14);
}

.page-content {
    flex: 1;
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 28px 28px 48px;
    overflow: auto;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    margin: 8px 0 6px;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.page-header p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    overflow: visible;
}

.page-toolbar-left {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.page-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.page-filters select,
.page-filters input[type="date"] {
    padding: 0;
    border: 0;
    background: transparent;
    font-size: inherit;
}

.page-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    margin-bottom: 18px;
    position: relative;
    z-index: 1;
}

.page-card-narrow {
    max-width: 520px;
}

.page-card-title {
    margin: 0 0 16px;
    font-size: 16px;
    font-weight: 500;
}

.page-card-title i {
    margin-right: 8px;
    color: var(--accent);
}

.page-form {
    max-width: 100%;
}

.page-divider {
    height: 1px;
    background: var(--border);
    margin: 20px 0;
}

.btn-back {
    margin-bottom: 4px;
}

.form-hint {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--muted);
}

.plan-field-fixed-plus {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.plan-field-hint {
    font-size: 12px;
    color: var(--muted);
}

.entry-value-fixed-part {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 4px;
}

.entry-value-part-label {
    font-weight: 500;
    color: var(--text);
    margin-right: 4px;
}

.plan-copy-card {
    margin-bottom: 20px;
    border-style: dashed;
}

.plan-copy-desc {
    margin: -8px 0 16px;
}

.plan-copy-form {
    margin-top: 0;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
}

.text-muted {
    color: var(--muted);
    font-size: 13px;
}

.table-actions {
    text-align: right;
    white-space: nowrap;
}

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

.stats-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.stats-list li {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.stats-list li:last-child {
    border-bottom: 0;
}

.entry-values-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.entry-value-item {
    padding: 14px 0;
    border-bottom: 1px solid #eee;
}

.entry-value-item:last-child {
    border-bottom: 0;
}

.entry-value-label {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 4px;
}

.entry-value-label i {
    margin-right: 6px;
}

.entry-value-content {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 2px;
}

.entry-value-type {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
}

.flash {
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
}

.flash-success {
    background: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}

.flash-error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.workspace {
    display: flex;
    flex: 1;
    min-height: 0;
}

.list-panel {
    flex: 1;
    padding: 16px;
    overflow: auto;
}

.detail-panel {
    width: 420px;
    background: var(--white);
    border-left: 1px solid var(--border);
    overflow: auto;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.04);
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.toolbar-spacer {
    flex: 1;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--border-strong);
    background: var(--white);
    color: var(--text);
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
    border-color: transparent;
    color: var(--white);
    box-shadow: 0 8px 20px var(--brand-glow);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 100%);
    box-shadow: 0 10px 24px rgba(0, 62, 126, 0.28);
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: var(--white);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

.btn i {
    margin-right: 4px;
}

.toolbar-info {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
}

.toolbar-meta {
    font-size: 12px;
    color: var(--muted);
}

.empty-state-icon {
    font-size: 32px;
    color: #c5d0d8;
    margin-bottom: 12px;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    position: relative;
    z-index: 1;
}

.data-table th,
.data-table td {
    padding: 12px 14px;
    text-align: left;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: #f8fafc;
    color: var(--muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.data-table tbody tr:hover {
    background: var(--brand-soft);
}

.data-table tbody tr.is-selected {
    background: var(--selected-bg);
    box-shadow: inset 3px 0 0 var(--brand);
}

.group-header td {
    background: #f5f8fa;
    font-weight: 500;
    color: var(--muted);
}

.group-toggle {
    border: 0;
    background: transparent;
    cursor: pointer;
    margin-right: 6px;
}

.is-hidden {
    display: none;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    background: #e8eef2;
}

.badge-active {
    background: #ecfdf5;
    color: #065f46;
}

.badge-inactive {
    background: #fef2f2;
    color: #991b1b;
}

.detail-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.detail-header h2 {
    margin: 0 0 4px;
    font-size: 18px;
}

.detail-subtitle {
    color: var(--muted);
    font-size: 12px;
}

.detail-body {
    padding: 16px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: #ffffff;
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-glow);
}

.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.section-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    margin: 18px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.field-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.field-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}

.empty-state {
    padding: 40px;
    text-align: center;
    color: var(--muted);
    background: var(--white);
    box-shadow: var(--shadow);
}

.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    background: #f3f9ff;
}

.login-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    position: relative;
    z-index: 1;
    background: #f3f9ff;
}

.login-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    background: #e8f4fd;
    color: var(--brand-dark);
    position: relative;
    overflow: hidden;
}

.login-hero-logo {
    position: relative;
    display: block;
    width: min(320px, 80%);
    height: auto;
    margin: 0;
    filter: drop-shadow(0 8px 20px rgba(0, 62, 126, 0.1));
}

.login-hero-desc {
    position: relative;
    margin: 16px 0 0;
    max-width: 380px;
    font-size: 15px;
    line-height: 1.6;
    opacity: 0.92;
    text-align: center;
}

.login-card-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background: linear-gradient(180deg, #f8fcff 0%, #eef6ff 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    padding: 32px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 2;
}

.login-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 22px;
}

.login-card-head-main {
    flex: 1;
    min-width: 0;
}

.login-card-head .login-card-sub {
    margin-bottom: 0;
}

.login-card h1 {
    margin: 0 0 6px;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.login-card-sub {
    margin: 0 0 22px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.login-error {
    background: #fef2f2;
    color: #991b1b;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
    border: 1px solid #fecaca;
}

.login-card-wide {
    max-width: 420px;
}

.login-page .btn-primary {
    background: #e8f4fd;
    border: 1px solid rgba(0, 62, 126, 0.12);
    color: var(--brand-dark);
    box-shadow: none;
    font-weight: 600;
}

.login-page .btn-primary:hover {
    background: #dceefb;
    border-color: rgba(0, 62, 126, 0.2);
    color: var(--brand-dark);
    box-shadow: var(--shadow-sm);
}

.login-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 20px;
}

.login-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 13px;
    background: #f7f9fb;
}

.login-tab.is-active {
    background: var(--selected-bg);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 500;
}

.login-desc {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 14px;
}

.worker-shell {
    min-height: 100vh;
    min-height: 100dvh;
    background: transparent;
    display: flex;
    flex-direction: column;
}

.worker-topbar {
    position: sticky;
    top: 0;
    z-index: 120;
    background: #ffffff;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 22px;
    padding-top: calc(14px + env(safe-area-inset-top));
    border-bottom: 1px solid var(--border-strong);
    box-shadow: 0 2px 12px rgba(0, 62, 126, 0.08);
}

.worker-topbar-info {
    font-size: 14px;
    min-width: 0;
    flex: 1;
}

.worker-topbar-info strong {
    color: var(--brand-dark);
    font-weight: 700;
}

.worker-topbar-info span {
    color: var(--muted);
    opacity: 1;
    font-weight: 500;
}

.worker-logout {
    color: var(--brand-dark);
    background: var(--brand-soft);
    border: 1px solid rgba(0, 62, 126, 0.14);
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    flex-shrink: 0;
    transition: background var(--transition), border-color var(--transition);
}

.worker-logout:hover {
    background: #dceefb;
    border-color: var(--brand-light);
}

.worker-content {
    flex: 1;
    max-width: 560px;
    width: 100%;
    margin: 0 auto;
    padding: 28px 16px 48px;
    animation: fade-up 0.45s ease both;
}

body.keyboard-visible .worker-content,
body.keyboard-visible .login-shell {
    padding-bottom: calc(24px + var(--keyboard-gap, 0px) + env(safe-area-inset-bottom));
}

body.keyboard-visible .worker-shell,
body.keyboard-visible.login-page {
    transform: translateY(calc(-1 * var(--viewport-offset-top, 0px)));
}

body.keyboard-visible.mobile-sheet-open .worker-shell,
body.keyboard-visible.mobile-sheet-open.login-page {
    transform: none;
}

.worker-header {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.worker-header-main {
    flex: 1;
    min-width: 0;
}

.cache-refresh-btn {
    flex-shrink: 0;
    background: #e8f4fd;
    border: 1px solid rgba(0, 62, 126, 0.12);
    color: var(--brand-dark);
    box-shadow: none;
    font-weight: 600;
}

.cache-refresh-btn:hover {
    background: #dceefb;
    border-color: rgba(0, 62, 126, 0.2);
    color: var(--brand-dark);
}

.cache-refresh-btn.is-loading i {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.worker-header h1 {
    margin: 8px 0 4px;
    font-size: 22px;
    font-weight: 500;
}

.worker-header p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.worker-date-card {
    margin-bottom: 16px;
    padding: 16px 18px;
}

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

.worker-days-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.worker-day-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    color: var(--text);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.worker-day-card:hover:not(.is-disabled) {
    border-color: var(--brand-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.worker-day-card.is-done {
    border-color: var(--brand);
    background: linear-gradient(135deg, var(--brand-soft) 0%, #fff 100%);
}

.worker-day-card.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.worker-day-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.worker-day-label {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--brand);
    line-height: 1.25;
}

.worker-day-date {
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
}

.worker-day-meta {
    font-size: 13px;
    color: var(--muted);
}

.worker-form-card,
.worker-date-card {
    background: rgba(255, 255, 255, 0.94);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    position: relative;
    z-index: 1;
    overflow: visible;
}

.worker-form-card {
    padding: 20px;
}

.worker-field-block input,
.worker-field-block select {
    background: #ffffff;
}

.worker-field-block {
    margin-bottom: 18px;
}

.worker-field-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.worker-field-label i {
    color: var(--muted);
}

.worker-field-block input,
.worker-field-block select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 15px;
    font-family: inherit;
    background: var(--white);
    color: var(--text);
}

.worker-field-fixed,
.worker-field-fixed-part {
    padding: 10px 12px;
    background: #f5f8fa;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
    color: var(--muted);
}

.worker-field-fixed-part {
    font-weight: 500;
    color: var(--text);
}

.btn-lg {
    padding: 12px 16px;
    font-size: 15px;
}

.date-dropdown {
    position: relative;
}

.date-dropdown.is-panel-open {
    z-index: 220;
}

.worker-date-card:has(.date-dropdown.is-panel-open),
.page-card:has(.date-dropdown.is-panel-open) {
    z-index: 220;
}

.date-dropdown.is-panel-open .custom-select.is-open {
    z-index: 240;
}

.date-dropdown-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 15px;
    font-family: inherit;
    background: var(--white);
    color: var(--muted);
    cursor: pointer;
    text-align: left;
}

.date-dropdown-trigger.is-filled {
    color: var(--text);
}

.date-dropdown-trigger[aria-expanded="true"] {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-glow);
}

.date-dropdown-trigger[aria-expanded="true"] .date-dropdown-icon {
    transform: rotate(180deg);
}

.date-dropdown-label {
    flex: 1;
    min-width: 0;
}

.date-dropdown-icon {
    color: var(--muted);
    font-size: 12px;
    transition: transform 0.15s ease;
}

.date-dropdown-panel {
    position: absolute;
    z-index: 30;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    padding: 12px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: var(--shadow);
    overflow: visible;
}

.date-dropdown-panel.is-portaled {
    position: fixed;
    z-index: calc(var(--z-sheet) - 20);
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    max-height: min(72vh, 520px);
    overflow: auto;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    border-radius: 20px 20px 0 0;
    border-bottom: 0;
    box-shadow: var(--shadow-lg);
}

.worker-entry-form .date-dropdown.is-panel-open,
.worker-field-block:has(.date-dropdown.is-panel-open) {
    z-index: calc(var(--z-sheet) - 40);
}

.worker-entry-delete-form {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.date-dropdown-panel[hidden] {
    display: none;
}

.date-picker-row {
    display: grid;
    grid-template-columns: 1fr 1.4fr 1fr;
    gap: 8px;
}

.date-picker-field {
    min-width: 0;
}

.date-picker-label {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    color: var(--muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.date-picker-part {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    background: var(--white);
    color: var(--text);
    appearance: none;
    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='M6 8 0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

.date-picker-part:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-glow);
}

.install-box {
    max-width: 600px;
    margin: 40px auto;
    background: var(--white);
    padding: 24px;
    box-shadow: var(--shadow);
}

.context-menu {
    position: fixed;
    background: var(--white);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    border-radius: 4px;
    min-width: 140px;
    z-index: 1000;
    display: none;
}

.context-menu.is-open {
    display: block;
}

.context-menu button,
.context-menu a {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    border: 0;
    background: transparent;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
}

.context-menu button:hover,
.context-menu a:hover {
    background: #f5f8fa;
}

/* Plans module */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 14px;
}

.plan-driver-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.plan-driver-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.plan-driver-card.is-active {
    border-color: var(--brand);
    box-shadow: 0 0 0 1px var(--brand-glow), var(--shadow);
}

.plan-driver-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
}

.plan-driver-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--brand-soft);
    color: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.plan-driver-info {
    flex: 1;
    min-width: 0;
}

.plan-driver-info h3 {
    margin: 0 0 2px;
    font-size: 14px;
    font-weight: 500;
}

.plan-driver-meta {
    font-size: 12px;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.plan-total-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 12px;
    background: #e8eef2;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
}

.plan-days-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    padding: 12px;
}

.plan-day-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--text);
    text-decoration: none;
    transition: all 0.15s ease;
}

.plan-day-chip:hover {
    border-color: var(--accent);
    background: #f7fcfc;
}

.plan-day-chip.is-selected {
    background: var(--selected-bg);
    border-color: var(--accent);
}

.plan-day-chip.is-empty .plan-day-count {
    color: #bbb;
}

.plan-day-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: var(--muted);
}

.plan-day-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
}

.plan-detail-header {
    background: #fafbfc;
}

.plan-detail-day-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    background: var(--accent);
    color: var(--white);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.plan-detail-title h2 {
    margin: 0;
}

.plan-detail-body {
    background: #f7f9fb;
}

.plan-empty-fields {
    text-align: center;
    padding: 24px 16px;
    color: var(--muted);
    font-size: 13px;
}

.plan-empty-fields i {
    font-size: 28px;
    color: #c5d0d8;
    margin-bottom: 8px;
    display: block;
}

.plan-fields-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.plan-field-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.plan-field-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #fafbfc;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.plan-field-order {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--selected-bg);
    color: var(--accent);
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.plan-field-card-head i {
    color: var(--muted);
    font-size: 12px;
}

.plan-field-card-head strong {
    flex: 1;
    min-width: 0;
}

.plan-field-save-status {
    margin-left: auto;
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
}

.plan-field-save-status.is-saving {
    color: var(--muted);
}

.plan-field-save-status.is-saved {
    color: var(--accent);
}

.plan-field-save-status.is-error {
    color: var(--danger);
}

.type-badge {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
    background: #e8eef2;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.plan-field-fixed-value {
    padding: 8px 12px;
    font-size: 12px;
    color: var(--muted);
    background: #f5f8fa;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 6px;
}

.plan-field-form {
    padding: 12px;
}

.plan-field-delete {
    padding: 0 12px 12px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.plan-field-actions {
    margin-top: 8px;
}

.plan-copy-card {
    margin-bottom: 20px;
    border-style: dashed;
}

.plan-copy-desc {
    margin: -8px 0 16px;
}

.plan-copy-form {
    margin-top: 0;
}

.plan-add-card {
    margin-top: 14px;
    background: var(--white);
    border: 1px dashed var(--border);
    border-radius: 6px;
    padding: 14px;
}

.plan-add-form {
    margin-top: 8px;
}

.section-title i {
    margin-right: 6px;
}

.group-toggle i {
    font-size: 11px;
}

.entries-filters {
    margin-bottom: 4px;
}

.entries-driver-section {
    margin-bottom: 28px;
}

.entries-driver-header {
    margin-bottom: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--border);
}

.entries-driver-header h2 {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 500;
}

.entries-driver-header p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.entries-sheet-card {
    padding: 0;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}

.entries-sheet-wrap {
    overflow-x: auto;
}

.entries-sheet-table {
    width: 100%;
    min-width: 860px;
    border-collapse: collapse;
    table-layout: fixed;
}

.entries-sheet-table th,
.entries-sheet-table td {
    border: 1px solid #222;
    padding: 10px 8px;
    font-size: 12px;
    vertical-align: top;
    line-height: 1.45;
}

.entries-sheet-table th {
    background: #fff;
    color: #111;
    font-weight: 700;
    text-align: center;
    font-size: 11px;
    line-height: 1.25;
}

.entries-sheet-table tbody tr:nth-child(even) {
    background: #fcfcfc;
}

.entries-sheet-table tbody tr:hover {
    background: var(--brand-soft);
}

.entries-sheet-col-date {
    width: 72px;
    text-align: center;
    white-space: nowrap;
}

.entries-sheet-col-km {
    width: 110px;
    text-align: center;
}

.entries-sheet-col-fuel {
    width: 150px;
}

.entries-sheet-col-extras {
    width: 240px;
}

.entries-sheet-col-mats {
    width: 220px;
}

.entries-sheet-date-link {
    color: var(--accent);
    font-weight: 500;
}

.entries-sheet-multiline {
    white-space: normal;
    word-break: break-word;
}

body.is-loading {
    overflow: hidden;
}

.page-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-loader.is-leaving {
    pointer-events: none;
    animation: loader-fade-out 0.45s ease forwards;
}

.page-loader-backdrop {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, #ffffff 0%, var(--brand-soft) 100%);
}

.page-loader-logo {
    position: relative;
    z-index: 1;
    display: block;
    width: min(280px, 68vw);
    height: auto;
    animation: loader-logo-in 0.55s ease both;
}

.page-loader.is-leaving .page-loader-logo {
    animation: loader-logo-out 0.45s ease forwards;
}

@keyframes loader-logo-in {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes loader-logo-out {
    to {
        opacity: 0;
        transform: scale(1.02);
    }
}

@keyframes loader-fade-out {
    to { opacity: 0; }
}

/* ─── Custom selects & UI kit ─── */
.custom-select {
    position: relative;
}

.custom-select.is-open {
    z-index: 300;
}

.custom-select.is-open.is-mobile-sheet {
    z-index: var(--z-sheet);
}

.custom-select-native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.custom-select-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.custom-select-trigger:hover {
    border-color: var(--brand-light);
}

.custom-select.is-open .custom-select-trigger,
.custom-select-trigger:focus-visible {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-glow);
}

.custom-select.is-placeholder .custom-select-value {
    color: var(--muted);
    font-weight: 400;
}

.custom-select-icon {
    color: var(--brand);
    font-size: 12px;
    transition: transform var(--transition);
}

.custom-select.is-open .custom-select-icon {
    transform: rotate(180deg);
}

.custom-select-menu {
    position: absolute;
    z-index: 120;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 280px;
    overflow: auto;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
    transition: opacity 0.18s ease, transform 0.18s ease;
    pointer-events: none;
}

.custom-select.is-visible .custom-select-menu,
.custom-select-menu.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.custom-select-menu.is-portaled {
    position: fixed;
    z-index: var(--z-sheet);
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    max-height: min(70vh, 480px);
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    border-radius: 20px 20px 0 0;
    border-bottom: 0;
    pointer-events: auto;
}

.custom-select-option {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
    padding: 10px 12px;
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.custom-select-option:hover {
    background: var(--brand-soft);
    color: var(--brand-dark);
}

.custom-select-option.is-selected {
    background: linear-gradient(135deg, var(--brand-soft) 0%, #fff 100%);
    color: var(--brand);
    font-weight: 600;
}

.custom-select-group-label {
    padding: 8px 12px 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.custom-select-compact .custom-select-trigger {
    padding: 10px 12px;
    font-size: 13px;
}

.custom-select-compact .custom-select-menu {
    max-height: 220px;
}

.ui-field {
    position: relative;
}

.ui-field-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--brand);
    font-size: 14px;
    z-index: 2;
    pointer-events: none;
}

.ui-field .custom-select,
.ui-field .ui-input {
    padding-left: 42px;
}

.ui-field .custom-select-trigger {
    padding-left: 42px;
}

.ui-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 14px;
    background: #fff;
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.ui-input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-glow);
}

.ui-input-date {
    min-height: 46px;
}

.ui-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--brand);
    cursor: pointer;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: visible;
}

@media (min-width: 769px) {
    .page-toolbar:has(.custom-select.is-open) {
        position: relative;
        z-index: 360;
    }

    .filter-bar:has(.custom-select.is-open) {
        position: relative;
        z-index: 360;
    }

    .filter-bar .custom-select.is-open {
        z-index: 370;
    }

    .filter-bar .custom-select-menu {
        z-index: 380;
    }
}

.filter-field {
    min-width: 180px;
    flex: 1 1 180px;
}

.filter-label {
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
}

.date-dropdown-trigger {
    border-radius: var(--radius-sm);
    background: #fff;
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.date-dropdown-trigger:hover {
    border-color: var(--brand-light);
    transform: translateY(-1px);
}

.date-dropdown-panel {
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    animation: dropdown-in 0.18s ease;
}

@keyframes dropdown-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.date-picker-part {
    appearance: none;
}

.app-shell {
    animation: app-in 0.45s ease both;
}

body.app-ready .page-content > * {
    animation: fade-up 0.45s ease both;
}

body.app-ready .page-content > *:nth-child(2) { animation-delay: 0.04s; }
body.app-ready .page-content > *:nth-child(3) { animation-delay: 0.08s; }
body.app-ready .page-content > *:nth-child(4) { animation-delay: 0.12s; }

@keyframes app-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.empty-state {
    border-radius: var(--radius);
    border: 1px dashed var(--border-strong);
    background: rgba(255, 255, 255, 0.85);
}

.empty-state-icon {
    color: var(--brand-light);
}

.worker-days-grid {
    gap: 12px;
}

.plan-day-chip {
    border-radius: 10px;
}

.plan-field-card {
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition);
}

.plan-field-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.page-content::-webkit-scrollbar,
.custom-select-menu::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.page-content::-webkit-scrollbar-thumb,
.custom-select-menu::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.page-content::-webkit-scrollbar-thumb:hover,
.custom-select-menu::-webkit-scrollbar-thumb:hover {
    background: var(--brand-light);
}

@media (max-width: 900px) {
    .login-shell {
        grid-template-columns: 1fr;
        min-height: 100dvh;
    }

    .login-hero {
        padding: calc(24px + env(safe-area-inset-top)) 20px 24px;
        min-height: auto;
        background: #e8f4fd;
    }

    .login-hero-logo {
        width: min(200px, 65%);
        margin: 0;
    }

    .login-hero-desc {
        display: none;
    }

    .login-card-wrap {
        padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
        background: #f8fcff;
    }

    .login-card-head {
        flex-direction: column;
        align-items: stretch;
    }

    .login-card-head .cache-refresh-btn {
        width: 100%;
        min-height: 48px;
    }

    .login-card {
        padding: 24px 20px;
        border-radius: var(--radius);
    }
}

@media (max-width: 768px) {
    body::after {
        display: none;
    }

    .app-shell {
        flex-direction: column;
    }

    .app-main {
        width: 100%;
        min-height: 100dvh;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(86vw, 300px);
        z-index: var(--z-sidebar);
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: var(--shadow-lg);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
        margin-left: -8px;
    }

    .topbar {
        height: auto;
        min-height: 56px;
        padding: 8px 12px 8px 8px;
        padding-top: calc(8px + env(safe-area-inset-top));
        flex-wrap: wrap;
        gap: 8px;
    }

    .topbar-title {
        font-size: 15px;
        max-width: 42vw;
    }

    .topbar-search {
        order: 3;
        flex: 1 1 100%;
        max-width: none;
        min-width: 0;
    }

    .topbar-search input {
        min-height: 44px;
        font-size: 16px;
    }

    .topbar-link {
        min-height: 44px;
        padding: 10px 12px;
    }

    .topbar-link span {
        display: none;
    }

    .page-content {
        padding: 16px 14px calc(28px + env(safe-area-inset-bottom));
    }

    .page-header h1 {
        font-size: 22px;
    }

    .page-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .page-toolbar-left {
        flex-direction: column;
        width: 100%;
    }

    .page-toolbar .btn,
    .page-toolbar-left .btn {
        width: 100%;
        min-height: 44px;
        justify-content: center;
    }

    .page-card {
        padding: 16px;
        border-radius: var(--radius-sm);
    }

    .page-card:has(.data-table) {
        padding: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .page-card:has(.data-table)::after {
        content: '← przesuń →';
        display: block;
        text-align: center;
        font-size: 11px;
        color: var(--muted);
        padding: 8px;
        border-top: 1px solid var(--border);
    }

    .data-table {
        min-width: 620px;
        border-radius: 0;
        box-shadow: none;
    }

    .data-table th,
    .data-table td {
        padding: 12px 10px;
    }

    .table-actions .btn {
        min-height: 40px;
    }

    .plans-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .plan-days-row {
        gap: 4px;
        padding: 10px;
    }

    .plan-day-chip {
        min-height: 52px;
        padding: 8px 2px;
    }

    .plan-day-label {
        font-size: 10px;
    }

    .plan-day-count {
        font-size: 13px;
    }

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

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
        min-height: 48px;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 12px;
    }

    .filter-field {
        min-width: 0;
        flex: 1 1 auto;
        width: 100%;
    }

    .date-picker-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .date-dropdown.is-panel-open .date-dropdown-panel {
        position: fixed;
        z-index: calc(var(--z-sheet) - 20);
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        margin: 0;
        padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
        border-radius: 20px 20px 0 0;
        border-bottom: 0;
        max-height: min(72vh, 520px);
        overflow: auto;
    }

    .custom-select.is-mobile-sheet .custom-select-menu {
        position: fixed;
        z-index: var(--z-sheet);
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        max-height: min(70vh, 480px);
        padding-bottom: calc(8px + env(safe-area-inset-bottom));
        border-radius: 20px 20px 0 0;
        border-bottom: 0;
        pointer-events: auto;
    }

    .custom-select-option {
        min-height: 48px;
        padding: 14px 14px;
        font-size: 16px;
    }

    .custom-select-trigger,
    .ui-input,
    .form-group input,
    .form-group select,
    .form-group textarea,
    .date-dropdown-trigger,
    .worker-field-block input,
    .worker-field-block select {
        font-size: 16px;
        min-height: 48px;
    }

    .btn {
        min-height: 44px;
        padding: 11px 16px;
    }

    .btn-lg {
        min-height: 52px;
        font-size: 16px;
    }

    .worker-topbar {
        flex-wrap: nowrap;
        gap: 10px;
        padding: 10px 14px;
        padding-top: calc(10px + env(safe-area-inset-top));
    }

    .worker-topbar-info {
        font-size: 14px;
        line-height: 1.35;
    }

    .worker-logout {
        min-height: 44px;
        padding: 8px 12px;
    }

    .worker-content {
        max-width: none;
        width: 100%;
        padding: 16px 14px calc(20px + env(safe-area-inset-bottom));
    }

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

    .cache-refresh-btn {
        width: 100%;
        min-height: 48px;
        justify-content: center;
    }

    .worker-header h1 {
        font-size: 24px;
    }

    .worker-day-card {
        min-height: 64px;
        padding: 18px 16px;
    }

    .worker-day-label {
        font-size: 20px;
    }

    .worker-entry-form .form-actions {
        position: sticky;
        bottom: 0;
        z-index: 20;
        margin: 0 -16px -16px;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
        background: linear-gradient(180deg, rgba(244, 246, 251, 0) 0%, rgba(244, 246, 251, 0.92) 24%, #f4f6fb 100%);
        border-top: 1px solid var(--border);
    }

    .worker-form-card {
        padding-bottom: 8px;
    }

    .entries-sheet-wrap {
        -webkit-overflow-scrolling: touch;
    }

    .entries-sheet-table {
        min-width: 720px;
    }

    .entries-driver-header {
        padding: 12px 14px;
    }

    .config-grid {
        grid-template-columns: 1fr;
    }

    .workspace {
        flex-direction: column;
    }

    .detail-panel {
        width: 100%;
        border-left: 0;
        border-top: 1px solid var(--border);
    }

    .list-panel {
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .topbar-search {
        display: none;
    }

    .login-hero {
        padding-top: calc(16px + env(safe-area-inset-top));
        padding-bottom: 16px;
    }

    .plan-driver-header {
        flex-wrap: wrap;
    }

    .plan-total-badge {
        width: 100%;
        justify-content: center;
        margin-top: 4px;
    }
}

.mobile-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-overlay);
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.mobile-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

body.mobile-sheet-open {
    overflow: hidden;
    touch-action: none;
}

.is-touch-device .plan-field-card:hover,
.is-touch-device .worker-day-card:hover:not(.is-disabled),
.is-touch-device .plan-driver-card:hover {
    transform: none;
}
