* {
    box-sizing: border-box;
}

:root {
    --bg: #f4f7fb;
    --card: #ffffff;
    --text: #172033;
    --muted: #667085;
    --border: #dce3ec;
    --primary: #155eef;
    --primary-dark: #004eeb;
    --primary-soft: #eef4ff;
    --success: #067647;
    --success-bg: #ecfdf3;
    --warning: #9a6700;
    --warning-bg: #fff8db;
    --danger: #b42318;
    --danger-bg: #fff0ee;
    --shadow: 0 14px 36px rgba(15, 23, 42, .08);
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: Inter, Arial, Helvetica, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(21, 94, 239, .08), transparent 32rem),
        linear-gradient(180deg, #fbfdff 0, var(--bg) 27rem);
}

a {
    color: inherit;
}

button,
input,
select {
    font: inherit;
}

/* LOGIN */

.sicoe-login {
    display: grid;
    min-height: 100vh;
    padding: 28px;
    place-items: center;
}

.sicoe-login-card {
    width: min(100%, 470px);
    padding: 34px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--card);
    box-shadow: var(--shadow);
}

.sicoe-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.sicoe-brand h1,
.sicoe-brand p {
    margin: 0;
}

.sicoe-brand h1 {
    font-size: 1.7rem;
    letter-spacing: -.03em;
}

.sicoe-brand p {
    margin-top: 5px;
    color: var(--muted);
}

.sicoe-logo {
    display: grid;
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
    place-items: center;
    border-radius: 17px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 10px 24px rgba(21, 94, 239, .22);
    font-weight: 850;
    letter-spacing: .04em;
}

.sicoe-alert {
    margin-top: 20px;
    padding: 14px 16px;
    border-radius: 12px;
    line-height: 1.45;
}

.sicoe-alert.error {
    color: var(--danger);
    border: 1px solid #ffd2cd;
    background: var(--danger-bg);
}

/* CAMPOS */

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

.sicoe-field label {
    color: var(--text);
    font-size: .92rem;
    font-weight: 750;
}

.sicoe-field input,
.sicoe-field select {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 11px;
    outline: none;
    background: #fff;
    color: var(--text);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.sicoe-field input:focus,
.sicoe-field select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(21, 94, 239, .1);
}

/* BOTONES */

.sicoe-btn {
    display: inline-flex;
    min-height: 42px;
    padding: 10px 15px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 10px;
    text-decoration: none;
    color: #fff;
    background: var(--primary);
    font-size: .9rem;
    font-weight: 750;
    cursor: pointer;
    transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}

.sicoe-btn:hover {
    transform: translateY(-1px);
    background: var(--primary-dark);
}

.sicoe-btn.light {
    color: var(--text);
    background: #eef2f6;
}

.sicoe-btn.red {
    color: var(--danger);
    background: var(--danger-bg);
}

.sicoe-btn.green {
    color: #fff;
    background: var(--success);
}

.sicoe-btn.dark {
    color: #fff;
    background: #344054;
}

.sicoe-btn.small {
    min-height: 34px;
    padding: 7px 10px;
    font-size: .8rem;
}

/* ADMINISTRACIÓN */

.sicoe-shell {
    min-height: 100vh;
}

.sicoe-header {
    position: sticky;
    z-index: 20;
    top: 0;
    display: flex;
    min-height: 84px;
    padding: 14px max(20px, calc((100% - 1220px) / 2));
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid rgba(220, 227, 236, .88);
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(14px);
}

.sicoe-header-title {
    display: flex;
    align-items: center;
    gap: 14px;
}

.sicoe-header-title h1,
.sicoe-header-title span {
    margin: 0;
}

.sicoe-header-title h1 {
    font-size: 1.45rem;
    letter-spacing: -.02em;
}

.sicoe-header-title span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: .9rem;
}

.sicoe-toolbar {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

.sicoe-container {
    width: min(1220px, calc(100% - 32px));
    margin: 30px auto 52px;
}

.sicoe-card {
    margin-bottom: 22px;
    padding: 26px;
    border: 1px solid var(--border);
    border-radius: 19px;
    background: var(--card);
    box-shadow: var(--shadow);
}

.sicoe-card.compact {
    background:
        linear-gradient(135deg, var(--primary-soft), #fff 70%);
}

.sicoe-card h2,
.sicoe-card h3 {
    margin-top: 0;
}

.sicoe-card h2 {
    font-size: 1.3rem;
    letter-spacing: -.02em;
}

.sicoe-card h3 {
    margin-top: 24px;
    font-size: 1rem;
}

.sicoe-form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

/* PERMISOS */

.sicoe-permisos {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.sicoe-permiso {
    display: grid;
    min-height: 92px;
    padding: 16px;
    grid-template-columns: 22px 1fr;
    align-items: flex-start;
    gap: 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.sicoe-permiso:hover {
    transform: translateY(-2px);
    border-color: #b8ccff;
    box-shadow: 0 10px 22px rgba(15, 23, 42, .07);
}

.sicoe-permiso input {
    width: 18px;
    height: 18px;
    margin-top: 2px;
}

.sicoe-permiso > span {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sicoe-permiso strong {
    color: var(--text);
    font-size: .95rem;
}

.sicoe-permiso span span {
    color: var(--muted);
    font-size: .84rem;
    line-height: 1.45;
}

/* TABLA */

.sicoe-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 14px;
}

.sicoe-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

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

.sicoe-table th {
    color: var(--muted);
    background: #f8fafc;
    font-size: .78rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.sicoe-table tbody tr:hover {
    background: #fbfdff;
}

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

.sicoe-perm-list {
    display: grid;
    gap: 5px;
    min-width: 220px;
    color: var(--muted);
    font-size: .82rem;
    line-height: 1.35;
}

/* BADGES */

.sicoe-badge {
    display: inline-flex;
    min-height: 28px;
    padding: 5px 9px;
    align-items: center;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 750;
    white-space: nowrap;
}

.sicoe-badge.admin {
    color: var(--primary);
    background: var(--primary-soft);
}

.sicoe-badge.user {
    color: #475467;
    background: #f2f4f7;
}

.sicoe-badge.ok {
    color: var(--success);
    background: var(--success-bg);
}

.sicoe-badge.off {
    color: var(--danger);
    background: var(--danger-bg);
}

@media (max-width: 1000px) {
    .sicoe-form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .sicoe-header {
        position: static;
        align-items: stretch;
        flex-direction: column;
    }

    .sicoe-toolbar {
        width: 100%;
    }

    .sicoe-toolbar .sicoe-btn {
        flex: 1;
    }

    .sicoe-permisos {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .sicoe-container {
        width: min(100% - 22px, 1220px);
    }

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

    .sicoe-card,
    .sicoe-login-card {
        padding: 20px;
        border-radius: 15px;
    }

    .sicoe-login {
        padding: 18px;
    }

    .sicoe-header-title {
        align-items: flex-start;
    }
}
