:root {
    --layout-max-width: none;
    --bg: #eef2f8;
    --surface: #ffffff;
    --surface-soft: #f2f6fc;
    --text: #0b1b31;
    --muted: #3f4f64;
    --primary: #0f5db8;
    --primary-strong: #0b4a93;
    --success: #1b8f45;
    --danger: #c73232;
    --warning: #c78316;
    --border: #bccce0;
    --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%, #cfe1ff 0, transparent 30%),
        radial-gradient(circle at 90% 0%, #daf1e5 0, transparent 32%),
        var(--bg);
    color: var(--text);
    font-family: "Avenir Next", "Segoe UI", "Noto Sans", sans-serif;
    font-weight: 400;
    margin: 0;
}

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

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

.container {
    margin-left: auto;
    margin-right: auto;
    max-width: var(--layout-max-width);
    padding-left: 0;
    padding-right: 0;
    width: calc(100% - 0.5rem);
}

.top-nav.container {
    align-items: center;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    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;
    position: relative;
    z-index: 120;
}

.main .container {
    margin-left: auto;
    margin-right: auto;
    max-width: var(--layout-max-width);
    padding-left: 0;
    padding-right: 0;
    width: calc(100% - 0.5rem);
}

.top-nav-title a {
    align-items: center;
    color: var(--text);
    display: inline-flex;
    text-decoration: none;
}

.top-nav-logo {
    display: block;
    height: 2.8rem;
    max-width: min(82vw, 32rem);
    width: auto;
}

.top-nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-width: 100%;
    overflow: visible;
    position: relative;
}

.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: #9eb7d8;
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.top-nav-dropdown {
    position: relative;
    z-index: 20;
}

.top-nav-dropdown > summary {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    font-size: 0.9rem;
    font-weight: 600;
    gap: 0.4rem;
    line-height: 1;
    list-style: none;
    padding: 0.5rem 0.85rem;
    user-select: none;
}

.top-nav-dropdown > summary::-webkit-details-marker {
    display: none;
}

.top-nav-dropdown[open] > summary {
    background: var(--surface-soft);
    border-color: #9eb7d8;
}

.top-nav-dropdown[open] {
    z-index: 40;
}

.top-nav-submenu {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 12rem;
    padding: 0.35rem;
    position: absolute;
    right: 0;
    top: calc(100% + 0.35rem);
    z-index: 220;
}

.top-nav-submenu a {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 9px;
    justify-content: flex-start;
    margin: 0;
    padding: 0.45rem 0.55rem;
    width: 100%;
}

@media (max-width: 760px) {
    .top-nav-logo {
        height: 2.2rem;
    }
}

.top-nav-submenu a:hover {
    background: var(--surface-soft);
    border-color: #d3dfee;
    box-shadow: none;
    transform: none;
}

.main {
    padding: 1rem 0 2rem;
    position: relative;
    z-index: 1;
}

.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;
    margin-left: 0;
    margin-right: 0;
    width: 100%;
}

.login-branding {
    align-items: center;
    background: var(--surface-soft);
    border: 1px solid #d2dff0;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1rem;
    padding: 0.7rem 0.8rem;
}

.login-branding-logo {
    display: block;
    height: 3.4rem;
    width: auto;
}

.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;
}

.content > .actions,
.index > .actions,
.view > .actions,
.form > .actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0.8rem;
}

.content > .actions .button,
.content > .actions a,
.index > .actions .button,
.index > .actions a,
.view > .actions .button,
.view > .actions a,
.form > .actions .button,
.form > .actions a {
    margin: 0;
}

.export-group {
    align-items: center;
    display: inline-flex;
    gap: 0.45rem;
    white-space: nowrap;
}

.content > .actions .button,
.index > .actions .button,
.view > .actions .button,
.form > .actions .button {
    align-items: center;
    display: inline-flex;
    justify-content: center;
    line-height: 1;
}

.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 #a9bfdc;
    border-radius: 10px;
    box-shadow: none;
    color: var(--text);
    margin-bottom: 0.95rem;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 93, 184, 0.22);
}

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

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

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

table tbody td {
    color: #25384f;
    font-weight: 400;
}

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

table th.actions {
    display: table-cell;
    min-width: 7.2rem;
    padding-left: 0.55rem;
    padding-right: 0.55rem;
    text-align: center;
    white-space: nowrap;
}

table td.actions {
    display: table-cell;
    min-width: 7.2rem;
    padding-left: 0.55rem;
    padding-right: 0.55rem;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}

.row-actions {
    align-items: center;
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 0.3rem;
    justify-content: center;
    width: auto;
}

.row-actions a,
.row-actions form {
    display: inline-flex;
    margin: 0;
    padding: 0;
    vertical-align: middle;
}

.row-actions form button {
    margin: 0;
}

.col-right {
    text-align: right;
}

.detail-table td {
    text-align: right;
}

.icon-btn {
    align-items: center;
    background: #fff;
    border: 1px solid #9eb4d2;
    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: #7e9fc8;
    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-top: 0.25rem;
    margin-bottom: 1rem;
}

.kpi {
    background: linear-gradient(180deg, #f6faff 0%, #eaf3ff 100%);
    border: 1px solid #bdd1ea;
    border-radius: 12px;
    color: #3a4f68;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.85rem;
}

.kpi strong {
    color: var(--text);
    display: inline;
    font-size: 1.2rem;
    line-height: 1.1;
    margin: 0;
    white-space: nowrap;
}

.paginator {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: space-between;
    margin-top: 1rem;
}

.pagination {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.pagination li {
    list-style: none;
    margin: 0;
}

.pagination a,
.pagination span,
.pagination .current {
    align-items: center;
    background: #ffffff;
    border: 1px solid #9fb8db;
    border-radius: 999px;
    color: #1f3f68;
    display: inline-flex;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1;
    min-height: 2.1rem;
    min-width: 2.1rem;
    padding: 0.48rem 0.72rem;
    text-decoration: none;
}

.pagination a:hover {
    background: #eaf2ff;
    border-color: #6f97cb;
    color: #16365f;
}

.pagination .current {
    background: #0f5db8;
    border-color: #0f5db8;
    color: #ffffff;
}

.pagination .disabled {
    background: #f2f5fb;
    border-color: #d3deee;
    color: #8aa0bf;
}

.paginator p {
    color: #3c4f67;
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0;
}

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

.flash.success {
    background: #e9f8ef;
    border-color: #9fd7b2;
}

.flash.error {
    background: #fff0f0;
    border-color: #efb3b3;
}

.attendance-table tr.attendance-weekend td {
    background: #f7f1de;
}

.attendance-table tr.attendance-holiday td {
    background: #fde9e9;
}

.attendance-table tr.attendance-weekend.attendance-holiday td {
    background: #f7e7d3;
}

@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-dropdown {
        width: 100%;
    }

    .top-nav-dropdown > summary {
        justify-content: center;
        width: 100%;
    }

    .top-nav-submenu {
        box-shadow: var(--shadow-sm);
        min-width: 0;
        position: static;
        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;
    }

    .paginator {
        align-items: flex-start;
        flex-direction: column;
    }
}

.support-filter-actions {
    align-items: flex-end;
    display: flex;
}

.support-meta {
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.35;
}

.support-mono {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    word-break: break-all;
}

.support-pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.support-pill {
    background: var(--surface-soft);
    border: 1px solid #c8d8eb;
    border-radius: 999px;
    color: var(--text);
    display: inline-flex;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.35rem 0.55rem;
    white-space: nowrap;
}

.support-report-description {
    max-width: 34rem;
    min-width: 18rem;
    white-space: normal;
}

.support-empty {
    color: var(--muted);
    padding: 1rem;
    text-align: center;
}

@media (max-width: 768px) {
    .support-report-description {
        max-width: none;
        min-width: 14rem;
    }
}
