
:root {
    --bg: #f4f6f8;
    --card: #ffffff;
    --text: #1f2933;
    --muted: #5f6c7b;
    --accent: #1f4e79;
    --accent-hover: #173b5c;
    --border: #d9e2ec;
    --danger-bg: #fee2e2;
    --danger-text: #991b1b;
    --success-bg: #dcfce7;
    --success-text: #166534;
    --shadow: 0 8px 24px rgba(31, 41, 51, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    margin: 0;
    background: var(--bg);
    color: var(--text);
}

.site-header {
    background: linear-gradient(135deg, #1f4e79 0%, #173b5c 100%);
    color: #ffffff;
    padding: 28px 24px 30px;
}

.site-header__inner {
    max-width: 1500px;
    width: calc(100% - 2rem);
    margin: 0 auto;
}

.site-header h1 {
    margin: 0 0 8px;
    font-size: 38px;
    line-height: 1.1;
}

.site-header p {
    margin: 0;
    color: rgba(255, 255, 255, 0.86);
    font-size: 17px;
}

.app-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    justify-content: center;
    max-width: 1500px;
    width: calc(100% - 2rem);
    margin: 26px auto 0;
}

.app-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 11px 18px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    text-decoration: none;
    font-weight: 800;
    line-height: 1.2;
}

.app-nav a:hover {
    background: rgba(255, 255, 255, 0.22);
    text-decoration: none;
}

.user-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
    max-width: 1500px;
    width: calc(100% - 2rem);
    margin: 16px auto 0;
    color: #ffffff;
    font-weight: 800;
}

.user-menu a,
.user-role,
.logout-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 11px;
    border-radius: 999px;
    border: 0;
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}

.user-menu a:hover,
.logout-form button:hover {
    background: rgba(255, 255, 255, 0.22);
    text-decoration: none;
}

.logout-form {
    margin: 0;
}

.page-content {
    max-width: 1500px;
    width: calc(100% - 3rem);
    margin: 32px auto;
    background: var(--card);
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

h2 {
    margin-top: 0;
    font-size: 28px;
}

h3 {
    font-size: 22px;
}

.grid-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-weight: 700;
}

select,
input,
textarea {
    padding: 0.72rem 0.78rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #ffffff;
    color: var(--text);
}

button,
.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0.72rem 1rem;
    border: 0;
    border-radius: 10px;
    background: var(--accent);
    color: #ffffff;
    text-decoration: none;
    font-weight: 800;
    cursor: pointer;
}

button:hover,
.button-link:hover {
    background: var(--accent-hover);
    text-decoration: none;
}

.button-link {
    margin-left: 0.75rem;
}

.button-link-left {
    margin-left: 0;
}

.preview-panel,
section {
    background: #f8fafc;
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: 14px;
    margin-bottom: 1rem;
}

section section {
    background: #ffffff;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 1rem;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.data-table th,
.data-table td {
    border-bottom: 1px solid var(--border);
    padding: 0.62rem;
    text-align: left;
    vertical-align: top;
}

.data-table th {
    background: #f8fafc;
    color: var(--text);
    font-weight: 800;
}

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

.duplicate-row {
    background: #fff1f2;
}

.duplicate-warning,
.notice,
.warning {
    padding: 14px 16px;
    border-radius: 14px;
    margin: 14px 0;
    background: var(--danger-bg);
    color: var(--danger-text);
    font-weight: 800;
}

.bulk-select-column {
    white-space: nowrap;
    text-align: center;
}

.bulk-select-all-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-weight: 700;
}

.bulk-select-all-label input[type="checkbox"] {
    cursor: pointer;
}

.data-table form {
    margin: 0;
}

.data-table button,
.data-table select,
.data-table input {
    font-size: 0.9rem;
    padding: 0.45rem 0.55rem;
}

.data-table input[type="password"] {
    max-width: 150px;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
    margin-top: 1rem;
}

.table-scroll .data-table {
    margin-top: 0;
}

.admin-product-configurations-table {
    min-width: 1350px;
}

.admin-product-configurations-table th,
.admin-product-configurations-table td {
    vertical-align: top;
}

.admin-product-configurations-table th:nth-child(3),
.admin-product-configurations-table td:nth-child(3) {
    min-width: 220px;
    max-width: 320px;
}

.admin-product-configurations-table th:nth-child(13),
.admin-product-configurations-table td:nth-child(13) {
    min-width: 135px;
}

.admin-product-configurations-table th:nth-child(14),
.admin-product-configurations-table td:nth-child(14) {
    min-width: 95px;
}

.audit-log-table {
    min-width: 1200px;
}

.audit-log-table th,
.audit-log-table td {
    vertical-align: top;
}

.audit-log-table th:nth-child(6),
.audit-log-table td:nth-child(6) {
    min-width: 260px;
}

.audit-log-table th:nth-child(7),
.audit-log-table td:nth-child(7) {
    min-width: 220px;
}

.audit-log-table details summary {
    cursor: pointer;
    font-weight: 700;
}

.audit-log-table details h4 {
    margin: 0.75rem 0 0.35rem 0;
}

.json-cell {
    max-width: 520px;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    padding: 0.5rem;
    background: #f7f7f7;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.85rem;
}

.header-account-link {
    color: #ffffff;
    text-decoration: underline;
}

.checkbox-label {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
}

.table-checkbox-label {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 0.35rem;
    margin: 0.35rem 0;
    font-weight: 400;
}

.table-checkbox-label input[type="checkbox"] {
    width: auto;
}

.admin-master-table {
    min-width: 950px;
}

.inline-sort-form {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 0.35rem;
}

.sort-order-input {
    width: 90px;
}

.sort-order-actions {
    margin: 1rem 0;
}

.sort-order-actions button {
    font-weight: 800;
}

.compatibility-rule-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    gap: 1rem;
}

.compatibility-rule-form select[multiple] {
    min-height: 12rem;
}

.compatibility-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}

.compatibility-rule-card h4 {
    margin-top: 0;
}

.compatibility-rule-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.status-pill {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

.status-active {
    background: #e8f7e8;
    border: 1px solid #228b22;
    color: #155d15;
}

.status-inactive {
    background: #f2f2f2;
    border: 1px solid #999;
    color: #555;
}

.inactive-rule {
    opacity: 0.75;
}

.dashboard-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    list-style: none;
    padding: 0;
    margin: 16px 0 0;
}

.dashboard-actions a {
    display: block;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #ffffff;
    color: var(--accent);
    text-decoration: none;
    font-weight: 800;
    box-shadow: 0 4px 14px rgba(31, 41, 51, 0.05);
}

.dashboard-actions a:hover {
    border-color: var(--accent);
    color: var(--accent-hover);
}

.login-panel {
    max-width: 720px;
    margin: 0 auto;
}

@media (max-width: 900px) {
    .grid-form,
    .compatibility-rule-form,
    .compatibility-summary-grid {
        grid-template-columns: 1fr;
    }

    .page-content {
        width: calc(100% - 1.5rem);
        padding: 18px;
    }

    .site-header h1 {
        font-size: 32px;
    }
}
