:root {
    --bg: #120c0b;
    --bg-soft: #1a1110;
    --panel: rgba(39, 22, 20, 0.9);
    --panel-strong: #2a1715;
    --border: rgba(168, 97, 84, 0.22);
    --text: #f6ebe7;
    --muted: #c6aaa2;
    --accent: #b24a3d;
    --accent-soft: #7c3129;
    --accent-2: #d16a55;
    --success: #2c8b67;
    --danger: #d15d59;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
    --radius: 18px;
    --radius-sm: 12px;
    --input-bg: rgba(22, 14, 13, 0.88);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top right, rgba(178, 74, 61, 0.18), transparent 28%),
        radial-gradient(circle at bottom left, rgba(91, 36, 30, 0.22), transparent 24%),
        linear-gradient(180deg, #140d0c 0%, #0f0908 100%);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--text);
    border-radius: 14px;
    padding: 13px 14px;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(209, 106, 85, 0.6);
    box-shadow: 0 0 0 4px rgba(178, 74, 61, 0.15);
}

textarea {
    min-height: 150px;
    resize: vertical;
}

button {
    border: 0;
    cursor: pointer;
}

pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: Consolas, Monaco, monospace;
}

.mono {
    font-family: Consolas, Monaco, monospace;
    font-size: 0.93rem;
}

.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 14px;
    font-weight: 600;
    transition: transform .18s ease, opacity .18s ease, background .18s ease;
}

.btn-primary:hover,
.btn-secondary:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
    color: #fff8f6;
    box-shadow: 0 10px 26px rgba(178, 74, 61, 0.25);
}

.btn-secondary {
    border: 1px solid var(--border);
    background: rgba(40, 25, 23, 0.65);
    color: var(--text);
}

.btn-full {
    width: 100%;
}

.flash-message {
    margin-bottom: 20px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid transparent;
    font-size: 0.95rem;
}

.flash-success {
    background: rgba(44, 139, 103, 0.14);
    border-color: rgba(44, 139, 103, 0.3);
    color: #dff8ee;
}

.flash-error {
    background: rgba(209, 93, 89, 0.12);
    border-color: rgba(209, 93, 89, 0.3);
    color: #ffe8e7;
}

.form-error,
.form-success {
    padding: 12px 14px;
    border-radius: 14px;
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.form-error {
    background: rgba(209, 93, 89, 0.12);
    border: 1px solid rgba(209, 93, 89, 0.28);
}

.form-success {
    background: rgba(44, 139, 103, 0.12);
    border: 1px solid rgba(44, 139, 103, 0.28);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 0.86rem;
    font-weight: 700;
}

.status-badge.is-active {
    background: rgba(44, 139, 103, 0.16);
    color: #dff8ee;
}

.status-badge.is-inactive {
    background: rgba(209, 93, 89, 0.16);
    color: #ffe4e3;
}

.table-link {
    color: #f1d1c8;
    font-size: 0.92rem;
    background: transparent;
    padding: 0;
}

.table-danger {
    color: #ff9f9a;
}

.inline-form {
    display: inline;
}

.field-help {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.86rem;
}

::-webkit-scrollbar {
    width: 11px;
    height: 11px;
}

::-webkit-scrollbar-track {
    background: rgba(20, 11, 10, 0.65);
}

::-webkit-scrollbar-thumb {
    background: rgba(178, 74, 61, 0.4);
    border-radius: 999px;
}


.custom-check,
.permission-check {
    position: relative;
}

.custom-check input,
.permission-check input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
}

.check-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 7px;
    border: 1px solid rgba(209, 106, 85, 0.34);
    background: rgba(20, 12, 11, 0.88);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: background .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease;
    flex-shrink: 0;
}

.check-indicator::after {
    content: "";
    width: 5px;
    height: 10px;
    border-right: 2px solid #fff7f4;
    border-bottom: 2px solid #fff7f4;
    transform: rotate(45deg) scale(0.65);
    opacity: 0;
    transition: transform .18s ease, opacity .18s ease;
    margin-top: -1px;
}

.custom-check input:focus + .check-indicator,
.permission-check input:focus + .check-indicator {
    border-color: rgba(209, 106, 85, 0.64);
    box-shadow: 0 0 0 4px rgba(178, 74, 61, 0.15);
}

.custom-check input:checked + .check-indicator,
.permission-check input:checked + .check-indicator {
    border-color: rgba(209, 106, 85, 0.7);
    background: linear-gradient(135deg, rgba(178, 74, 61, 0.96) 0%, rgba(209, 106, 85, 0.96) 100%);
}

.custom-check input:checked + .check-indicator::after,
.permission-check input:checked + .check-indicator::after {
    transform: rotate(45deg) scale(1);
    opacity: 1;
}
