:root {
    --bg: #f3f6fb;
    --surface: #ffffff;
    --surface-soft: #f8fbff;
    --text: #11223a;
    --muted: #5c6b7f;
    --primary: #1565c0;
    --primary-strong: #0d4f9c;
    --success: #1b8f45;
    --danger: #c73232;
    --warning: #c78316;
    --border: #d9e2ef;
    --shadow-sm: 0 6px 18px rgba(13, 28, 54, 0.08);
    --shadow-md: 0 14px 34px rgba(13, 28, 54, 0.12);
    --radius: 12px;
}

* {
    box-sizing: border-box;
}

body {
    background:
        radial-gradient(circle at 12% 10%, #dbe9ff 0, transparent 28%),
        radial-gradient(circle at 90% 0%, #e6f7ef 0, transparent 30%),
        var(--bg);
    color: var(--text);
    font-family: "Avenir Next", "Segoe UI", "Noto Sans", sans-serif;
    margin: 0;
}

a {
    color: var(--primary);
}

a:hover {
    color: var(--primary-strong);
}

.container {
    width: min(1200px, calc(100% - 2rem));
}

.top-nav.container {
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: space-between;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
}

.top-nav-title a {
    color: var(--text);
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-decoration: none;
}

.top-nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.top-nav-links a {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    display: inline-flex;
    font-size: 0.9rem;
    font-weight: 600;
    gap: 0.4rem;
    line-height: 1;
    padding: 0.5rem 0.85rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.top-nav-links a:hover {
    border-color: #b7c9e3;
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.main {
    padding: 1rem 0 2rem;
}

.main .container > .flash,
.main .container > .content,
.main .container > .index,
.main .container > .form,
.main .container > .view,
.main .container > .row {
    animation: fade-in 0.24s ease-out;
}

.content,
.form,
.view,
.index,
.row > .column > .content,
.row > .column.column-80 > .content,
.row > .column > .form,
.row > .column.column-80 > .form,
.row > .column > .view,
.row > .column.column-80 > .view {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1rem;
}

h1,
h2,
h3,
h4 {
    color: var(--text);
    letter-spacing: 0.01em;
}

h3 {
    font-size: 1.45rem;
    margin-top: 0.2rem;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0.8rem;
}

.actions .button,
.actions a {
    margin: 0;
}

.button,
button,
input[type="button"],
input[type="submit"] {
    background: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(21, 101, 192, 0.2);
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.01em;
    transition: all 0.2s ease;
}

.button:hover,
button:hover,
input[type="button"]:hover,
input[type="submit"]:hover {
    background: var(--primary-strong);
    border-color: var(--primary-strong);
    transform: translateY(-1px);
}

.button.button-outline,
button.button-outline {
    background: var(--surface);
    border-color: var(--border);
    box-shadow: none;
    color: var(--text);
}

.button.button-outline:hover,
button.button-outline:hover {
    background: var(--surface-soft);
    border-color: #b8c9e2;
    color: var(--text);
}

label {
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

input,
select,
textarea {
    background: #fff;
    border: 1px solid #c8d6ea;
    border-radius: 10px;
    box-shadow: none;
    color: var(--text);
    margin-bottom: 0.95rem;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #86abdf;
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.12);
}

table {
    background: #fff;
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

table thead th {
    background: var(--surface-soft);
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

table th,
table td {
    border-bottom: 1px solid #e7edf6;
    padding: 0.72rem 0.7rem;
}

table tbody tr:hover {
    background: #f9fbff;
}

table th.actions {
    display: table-cell;
    white-space: nowrap;
}

table td.actions {
    vertical-align: middle;
    white-space: nowrap;
}

table td.actions a,
table td.actions form {
    display: inline-flex;
    margin: 0 0.4rem 0 0;
    vertical-align: middle;
}

table td.actions form:last-child,
table td.actions a:last-child {
    margin: 0;
}

.icon-btn {
    align-items: center;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    display: inline-flex;
    height: 2.1rem;
    justify-content: center;
    padding: 0;
    text-decoration: none;
    white-space: nowrap;
    width: 2.1rem;
}

.icon-btn:hover {
    border-color: #b4c7e2;
    box-shadow: var(--shadow-sm);
}

.icon-btn .fa-plus { color: var(--success); }
.icon-btn .fa-list { color: var(--muted); }
.icon-btn .fa-eye { color: var(--primary); }
.icon-btn .fa-pen { color: var(--warning); }
.icon-btn .fa-trash { color: var(--danger); }

.kpi-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    margin-bottom: 1rem;
}

.kpi {
    background: linear-gradient(180deg, #fafdff 0%, #f3f8ff 100%);
    border: 1px solid #d8e5f6;
    border-radius: 12px;
    color: var(--muted);
    padding: 0.85rem;
}

.kpi strong {
    color: var(--text);
    display: block;
    font-size: 1.8rem;
}

.paginator {
    margin-top: 1rem;
}

.pagination a,
.pagination span {
    border-radius: 10px;
}

.flash,
.message {
    background: #eef5ff;
    border: 1px solid #c9dcf8;
    border-radius: 10px;
    color: var(--text);
    padding: 0.75rem 0.9rem;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .container {
        width: calc(100% - 1rem);
    }

    .top-nav.container {
        margin-top: 0.5rem;
        padding: 0.6rem 0.7rem;
    }

    .top-nav-title {
        width: 100%;
    }

    .top-nav-title a {
        font-size: 1.2rem;
    }

    .top-nav-links {
        width: 100%;
    }

    .top-nav-links a {
        justify-content: center;
    }

    .content,
    .form,
    .view,
    .index {
        padding: 0.75rem;
    }

    table th,
    table td {
        padding: 0.55rem 0.45rem;
    }
}
