* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    font-family: "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f4f7fb;
    color: #1f2937;
    overflow-x: hidden;
    max-width: 100%;
}

.container {
    width: min(1200px, 92%);
    margin: 0 auto;
}

.header {
    background: #0f172a;
    color: #fff;
    padding: 20px 0;
    margin-bottom: 30px;
}

.header__content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    min-width: 0;
}

.header__brand {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.logo {
    margin: 0;
    font-size: 24px;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.subtitle {
    margin: 4px 0 0;
    font-size: 14px;
    opacity: 0.7;
    overflow-wrap: anywhere;
}

.nav {
    display: flex;
    gap: 18px;
    align-items: center;
    min-width: 0;
}

.nav a {
    color: #e2e8f0;
    text-decoration: none;
    font-weight: 500;
}

.nav__user {
    color: #94a3b8;
}

.lab-switch {
    margin: 0;
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
}

.lab-switch__label {
    cursor: pointer;
    outline: none;
}

.lab-switch__label:focus-visible {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.4);
    border-radius: 6px;
}

.lab-switch__menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    display: none;
    padding: 6px;
    background: #0f172a;
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.3);
    z-index: 10;
}

.lab-switch.is-open .lab-switch__menu {
    display: block;
}

.lab-switch__menu select {
    background: transparent;
    color: #e2e8f0;
    border: 1px solid #334155;
    padding: 6px 28px 6px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lab-switch__menu::after {
    content: "";
    position: absolute;
    right: 18px;
    top: 18px;
    width: 6px;
    height: 6px;
    border-right: 2px solid #94a3b8;
    border-bottom: 2px solid #94a3b8;
    transform: rotate(45deg);
    pointer-events: none;
}

.section {
    margin-bottom: 32px;
}

.section__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    min-width: 0;
}

.section__title {
    margin: 0;
    text-align: left;
}

.section__title-center {
    flex: 1;
    text-align: center;
}

.section__actions {
    margin-left: auto;
}

.section__title-center {
    flex: 1;
    text-align: center;
}

.section__actions {
    margin-left: auto;
}

.card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.card-title {
    margin: 0 0 12px;
    font-size: 16px;
}

.card-link {
    color: inherit;
    text-decoration: none;
}

.card--interactive {
    height: 100%;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.card-link:hover .card--interactive,
.card-link:focus-visible .card--interactive {
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.14);
}

.grid {
    display: grid;
    gap: 20px;
    min-width: 0;
}

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

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

.stat {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat__label {
    font-size: 14px;
    color: #64748b;
    overflow-wrap: anywhere;
}

.stat__value {
    font-size: 32px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid #cbd5f5;
    background: #fff;
    color: #1f2937;
    text-decoration: none;
    cursor: pointer;
    font-weight: 500;
}

.button.primary {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.button.secondary {
    background: #dbeafe;
    border-color: #bfdbfe;
    color: #1e3a8a;
}

.button.danger {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
}

.button-group {
    display: flex;
    gap: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    table-layout: fixed;
}

.table-fixed {
    width: 100%;
}

th,
td {
    text-align: left;
    padding: 12px 8px;
    border-bottom: 1px solid #e2e8f0;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.table-wrap {
    overflow-x: auto !important;
    max-width: 100%;
}

.table-wrap table {
    table-layout: fixed !important;
    width: 100% !important;
}

.table-wrap td,
.table-wrap th {
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    white-space: normal !important;
    max-width: 1px !important;
}

.break-anywhere {
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    white-space: normal !important;
    max-width: 100% !important;
}


.item-title {
    max-width: 100%;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.info-list li {
    word-break: break-word;
    overflow-wrap: anywhere;
}

.list li {
    word-break: break-word;
    overflow-wrap: anywhere;
}

tr.warning {
    background: #fefce8;
}

form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

input,
select,
textarea {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #cbd5f5;
    font-size: 14px;
}

.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.search-bar.compact {
    max-width: 620px;
}

.hint {
    margin-top: 0;
    margin-bottom: 14px;
    color: #475569;
    font-size: 14px;
}

.info-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 8px;
}

.list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 8px;
}

.messages {
    margin-bottom: 16px;
}

.message {
    padding: 10px 14px;
    border-radius: 8px;
    background: #dbeafe;
    color: #1e3a8a;
    margin-bottom: 8px;
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
}

.auth-body {
    background: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    color: #fff;
}

.auth-card {
    background: #fff;
    color: #1f2937;
    padding: 32px;
    border-radius: 14px;
    width: min(380px, 90%);
}

.error {
    color: #dc2626;
    font-size: 12px;
}

.item-row {
    cursor: pointer;
}

.item-row:hover {
    background: #f8fafc;
}

.row-action-link {
    position: relative;
    z-index: 2;
}

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

.hint-inline {
    font-size: 13px;
    color: #64748b;
}

.checkbox-col {
    width: 44px;
    text-align: center;
    padding-right: 10px;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    max-width: 100%;
}

.row-actions--owner {
    flex-wrap: wrap;
}

.row-actions form {
    margin: 0;
    display: inline-flex;
    max-width: 100%;
}

.row-actions .button {
    white-space: nowrap;
}

.button.action-soft {
    background: #e0f2fe;
    border-color: #bae6fd;
    color: #0369a1;
}

.item-table thead th {
    text-align: center;
}

.checkbox-col + th,
.checkbox-col + td {
    padding-left: 18px;
}

@media (max-width: 900px) {
    .header__content {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav {
        flex-wrap: wrap;
        row-gap: 10px;
    }
}

.radio-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    background: #e2e8f0;
    width: fit-content;
}

.radio-toggle > div {
    margin: 0;
}

.radio-toggle label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: 999px;
    cursor: pointer;
    background: transparent;
    color: #334155;
    font-weight: 600;
    transition: all 0.2s ease;
}

.radio-toggle > div:last-child label {
    border-right: none;
}

.radio-toggle input[type="radio"] {
    display: none;
}

.radio-toggle label.is-active {
    background: #2563eb;
    color: #fff;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
}

.toggle-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.switch-toggle {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #334155;
    font-weight: 600;
}

.switch-toggle__label {
    font-size: 14px;
    min-width: 72px;
    text-align: center;
}

.switch {
    position: relative;
    display: inline-block;
    width: 56px;
    height: 30px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch__slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5f5;
    transition: 0.2s;
    border-radius: 999px;
}

.switch__slider::before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 3px;
    bottom: 3px;
    background-color: #fff;
    transition: 0.2s;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
}

.switch input:checked + .switch__slider {
    background-color: #2563eb;
}

.switch input:checked + .switch__slider::before {
    transform: translateX(26px);
}
