.sidebar-logout-form {
    padding: 0 25px;
}

.app-topbar .topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-topbar .topbar-actions form {
    margin: 0;
}

.topbar-user-btn {
    min-height: 40px;
    border: 0 !important;
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 5px 10px 5px 12px;
    font-weight: 700;
    line-height: 1;
    appearance: none;
    -webkit-appearance: none;
    box-shadow: none;
}

.topbar-user-btn:focus,
.topbar-user-btn:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 .18rem rgba(10, 170, 164, .16);
}

.topbar-user-btn .user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: var(--primary-dark);
    flex: 0 0 auto;
    font-size: .88rem;
    font-weight: 900;
}

.topbar-user-btn .user-menu-name {
    display: inline-block;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-main);
    font-size: .86rem;
}

.topbar-user-btn .user-menu-arrow {
    color: var(--text-muted);
    font-size: .78rem;
}

.topbar-user-btn:hover {
    background: rgba(10, 170, 164, .1);
    color: var(--primary-dark);
}

.user-menu-dropdown .dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 8px;
    min-width: 220px;
}

.user-menu-dropdown .dropdown-item {
    border-radius: 10px;
    padding: 9px 10px;
    color: var(--text-main);
}

.user-menu-dropdown .dropdown-item:hover,
.user-menu-dropdown .dropdown-item:focus {
    background: rgba(10, 170, 164, .08);
    color: var(--primary-dark);
}

.sidebar-logout-form button {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 0;
    background: transparent;
    border: 0;
    color: var(--text-main);
    font-weight: 500;
    font-size: 0.9rem;
    text-align: start;
}

.sidebar-logout-form button:hover {
    color: var(--primary);
}

.empty-state {
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
}

.form-grid {
    display: grid;
    gap: 16px;
}

.form-grid.four-columns {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.content-grid {
    display: grid;
    gap: 24px;
}

.content-grid.two-columns {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.content-grid.three-columns {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.form-help {
    display: block;
    color: var(--text-muted);
    font-size: .78rem;
    margin-top: 4px;
}

.field-error {
    color: var(--error);
    font-size: 0.8rem;
}

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

.settings-gateway-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card);
    padding: 18px;
    background: var(--surface);
}

.settings-gateway-card h3 {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 16px;
}

.settings-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.settings-checkbox .form-check-input {
    margin: 0;
}

.publish-options {
    display: grid;
    gap: 10px;
}

.publish-option,
.publish-employee-choice {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-white);
    padding: 12px;
    cursor: pointer;
}

.publish-option:hover,
.publish-employee-choice:hover {
    border-color: var(--primary);
    background: rgba(10, 170, 164, .07);
}

.publish-option span,
.publish-employee-choice span {
    display: grid;
    gap: 2px;
}

.publish-option small,
.publish-employee-choice small {
    color: var(--text-muted);
}

.publish-employee-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 8px;
    max-height: 320px;
    overflow: auto;
    padding-inline-end: 4px;
}

.sticky-actions {
    position: sticky;
    bottom: 12px;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    background: rgba(255, 255, 255, .96);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-hover);
    padding: 14px 18px;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.template-builder {
    max-width: 100%;
}

.template-section-card {
    overflow: hidden;
}

.template-section-parts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.template-part-card {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--surface);
    padding: 14px;
    min-width: 0;
}

.template-part-title {
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 10px;
}

.template-part-card textarea {
    min-height: 86px;
    resize: vertical;
}

.sticky-preview {
    position: sticky;
    top: 92px;
}

.template-preview-paper {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 18px;
    max-width: 100%;
    overflow-x: auto;
}

.template-preview-section {
    display: flex;
    align-items: stretch;
    gap: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    min-height: 74px;
    background: #fff;
}

.template-preview-section:empty {
    display: none;
}

.template-preview-cell {
    flex: 0 0 auto;
    min-width: 90px;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 10px;
    border-inline-start: 1px solid var(--border-color);
    color: var(--text-main);
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.template-preview-cell:first-child {
    border-inline-start: 0;
}

.template-preview-cell img {
    max-width: 100%;
    max-height: 96px;
    object-fit: contain;
}

.template-preview-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 16px 0 12px;
}

.template-preview-title small {
    color: var(--text-muted);
}

.template-preview-table {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: .82rem;
}

.template-preview-table th,
.template-preview-table td {
    border: 1px solid var(--border-color);
    padding: 10px;
    text-align: center;
}

.template-preview-table th {
    background: var(--surface);
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--bg-main), var(--surface));
    padding: 24px;
}

.login-panel,
.legal-page {
    width: min(100%, 520px);
    background: var(--bg-white);
    border-radius: 16px;
    box-shadow: var(--shadow-hover);
    padding: 36px;
}

.register-panel {
    width: min(100%, 700px);
}

.public-body {
    min-height: 100vh;
    background: var(--bg-main);
}

.public-nav,
.public-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px min(5vw, 64px);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
}

.public-nav nav,
.public-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.public-main {
    padding: 32px min(5vw, 64px);
}

.legal-page {
    width: min(100%, 900px);
    margin: 0 auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--primary);
    font-weight: 700;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--primary);
    color: white;
}

.brand-logo {
    width: 220px;
    max-height: 72px;
}

.brand-logo-public {
    width: 230px;
    max-height: 76px;
}

.brand-logo-landing {
    width: 230px;
    max-height: 68px;
}

.brand small {
    display: block;
    color: var(--text-muted);
    font-weight: 400;
}

.shift-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.auth-card input,
.login-panel input,
.login-panel select,
.login-panel textarea {
    width: 100%;
    border-radius: var(--radius-btn);
    border: 1px solid var(--border-color);
    padding: 10px 16px;
    font-size: 0.9rem;
}

.panel {
    background: var(--bg-white);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
}

.panel.narrow {
    max-width: 760px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.panel-header h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-main);
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-white);
}

.table-wrap table {
    width: 100%;
    min-width: 760px;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
}

.table-wrap th,
.table-wrap td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    white-space: nowrap;
}

.table-wrap th {
    background: var(--surface);
    color: var(--text-muted);
    font-size: .78rem;
    font-weight: 800;
}

.table-wrap tbody tr {
    transition: background .16s ease;
}

.table-wrap tbody tr:hover {
    background: rgba(10, 170, 164, .07);
}

.table-wrap tbody tr:last-child td {
    border-bottom: 0;
}

.table-wrap td strong,
.table-wrap td small {
    display: block;
}

.table-wrap td small {
    color: var(--text-muted);
    margin-top: 3px;
}

.table-wrap .actions {
    flex-wrap: nowrap;
}

.table-wrap .button {
    padding: 7px 12px;
    min-height: 34px;
    font-size: .82rem;
}

.search-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.search-form input[type="search"] {
    flex: 1 1 260px;
    min-width: 220px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-btn);
    padding: 10px 14px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric {
    background: var(--bg-white);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow);
    padding: 22px;
}

.metric span {
    display: block;
    color: var(--text-muted);
    font-size: .85rem;
}

.metric strong {
    display: block;
    font-size: 1.7rem;
    color: var(--text-main);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-btn);
    padding: 9px 18px;
    border: 1px solid transparent;
    font-weight: 600;
}

.button-primary {
    background: var(--primary);
    color: #fff;
}

.button-muted {
    background: var(--surface);
    color: var(--text-main);
    border-color: var(--border-color);
}

.status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: .78rem;
    font-weight: 800;
    background: var(--surface);
    color: var(--text-main);
}

.status-active,
.status-paid,
.status-succeeded {
    background: rgba(34, 197, 94, .12);
    color: #15803d;
}

.status-cancelled,
.status-failed {
    background: rgba(239, 68, 68, .12);
    color: #b91c1c;
}

.status-pending,
.status-past_due,
.status-in_progress,
.status-medium {
    background: rgba(245, 158, 11, .14);
    color: #b45309;
}

.status-trial,
.status-draft,
.status-open {
    background: rgba(25, 182, 196, .14);
    color: #0D7F89;
}

.status-low {
    background: rgba(20, 184, 166, .12);
    color: #0f766e;
}

.status-high,
.status-urgent {
    background: rgba(239, 68, 68, .12);
    color: #b91c1c;
}

.section-header {
    background: var(--surface);
    padding: 10px 16px;
    border-radius: 8px;
    margin: 16px 0 8px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.message-stack {
    display: grid;
    gap: 10px;
}

.app-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border-radius: 10px;
    border-width: 1px;
    box-shadow: 0 12px 30px rgba(7, 52, 94, 0.08);
    font-weight: 700;
    line-height: 1.7;
}

.app-alert i {
    font-size: 1.2rem;
    margin-top: 2px;
}

.app-alert .btn-close {
    margin-inline-start: auto;
    margin-inline-end: 0;
}

.schedule-builder .card {
    border-radius: 8px;
}

.scope-panel {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    padding: 14px;
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 430px;
    overflow: hidden;
}

.scope-panel-title {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
    color: var(--text-main);
}

.scope-panel-title > i {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--surface);
    color: var(--primary);
}

.scope-panel-title strong,
.scope-panel-title span {
    display: block;
}

.scope-panel-title span {
    color: var(--text-muted);
    font-size: .78rem;
    margin-top: 3px;
}

.schedule-choice-list {
    height: 320px;
    max-height: 320px;
    overflow-y: auto;
    overflow-x: hidden;
    display: grid;
    gap: 8px;
    padding-inline-end: 4px;
    align-content: start;
    scrollbar-width: thin;
}

.schedule-choice-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    padding: 9px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-main);
    font-weight: 600;
    font-size: .82rem;
    cursor: pointer;
    line-height: 1.5;
    margin: 0;
}

.schedule-choice-item input {
    flex: 0 0 auto;
    margin: 0;
}

.schedule-choice-item span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.schedule-choice-empty {
    min-height: 120px;
    display: grid;
    place-items: center;
    color: var(--text-muted);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    background: var(--surface);
    text-align: center;
    padding: 16px;
}

.builder-form > .card:last-child {
    position: relative;
    z-index: 1;
    margin-top: 0;
}

@media (max-width: 991.98px) {
    .scope-panel {
        min-height: 360px;
    }

    .schedule-choice-list {
        height: 250px;
        max-height: 250px;
    }
}

.precheck-list {
    display: grid;
    gap: 12px;
}

.precheck-issue {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 12px;
    border: 1px solid var(--border-color);
    border-inline-start-width: 5px;
    border-radius: 8px;
    background: #fff;
    padding: 14px;
}

.precheck-issue h3 {
    font-size: .98rem;
    margin: 0 0 4px;
    color: var(--text-main);
    font-weight: 800;
}

.precheck-issue p {
    margin: 0 0 10px;
    color: var(--text-muted);
}

.precheck-issue .issue-icon {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
}

.precheck-issue .issue-solution {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-main);
    font-weight: 700;
    font-size: .85rem;
}

.issue-danger {
    border-color: #fecaca;
    border-inline-start-color: #ef4444;
}

.issue-danger .issue-icon {
    color: #dc2626;
    background: #fef2f2;
}

.issue-warning {
    border-color: #fde68a;
    border-inline-start-color: #f59e0b;
}

.issue-warning .issue-icon {
    color: #b45309;
    background: #fffbeb;
}

.issue-info {
    border-color: #bfdbfe;
    border-inline-start-color: #3b82f6;
}

.issue-info .issue-icon {
    color: #2563eb;
    background: #eff6ff;
}

.wizard-steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.wizard-step-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--border-color);
    background: var(--surface);
    color: var(--text-muted);
    border-radius: 8px;
    min-height: 48px;
    font-weight: 800;
}

.wizard-step-link span {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fff;
    color: var(--primary);
}

.wizard-step-link.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.wizard-step-panel {
    display: none;
}

.wizard-step-panel.active {
    display: block;
}

.wizard-choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
    max-height: 430px;
    overflow: auto;
    padding-inline-end: 4px;
}

.wizard-choice-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 10px;
    align-items: start;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface);
    padding: 12px;
    cursor: pointer;
    min-height: 74px;
}

.wizard-choice-card input {
    margin-top: 3px;
}

.wizard-choice-card .choice-title {
    font-weight: 800;
    color: var(--text-main);
}

.wizard-choice-card small {
    grid-column: 2;
    color: var(--text-muted);
}

.location-shift-list {
    display: grid;
    gap: 14px;
}

.location-shift-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    padding: 14px;
}

.location-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
    cursor: pointer;
}

.location-row strong,
.location-row small {
    display: block;
}

.location-row strong {
    color: var(--text-main);
}

.location-row small {
    color: var(--text-muted);
    margin-top: 2px;
}

.shift-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-inline-start: 28px;
}

.shift-select-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--border-color);
    border-inline-start: 4px solid var(--shift-color, var(--primary));
    border-radius: 999px;
    background: var(--surface);
    padding: 7px 10px;
    cursor: pointer;
    font-weight: 700;
}

.shift-select-pill span {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shift-select-pill small {
    color: var(--text-muted);
    font-weight: 600;
}

.constraint-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 14px;
}

.constraint-picker-group {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    padding: 14px;
}

.constraint-picker-group h3 {
    font-size: .98rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 0 0 12px;
}

.constraint-choice {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.constraint-choice:last-child {
    border-bottom: 0;
}

.constraint-choice strong,
.constraint-choice small {
    display: block;
}

.constraint-choice strong {
    color: var(--text-main);
}

.constraint-choice small {
    color: var(--text-muted);
    margin-top: 2px;
}

.constraint-choice em {
    font-style: normal;
    font-weight: 800;
    color: var(--primary);
    background: var(--primary-light);
    border-radius: 999px;
    padding: 4px 8px;
    font-size: .72rem;
}

@media (max-width: 767.98px) {
    .panel-header {
        align-items: stretch;
        flex-direction: column;
    }

    .panel-header .actions,
    .sticky-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .panel-header .button,
    .sticky-actions .button {
        width: 100%;
    }

    .wizard-steps {
        grid-template-columns: 1fr;
    }

    .shift-pills {
        padding-inline-start: 0;
    }
}
