:root {
    --app-navy: #0f2f5f;
    --app-blue: #1d4ed8;
    --app-sky: #0ea5e9;
    --app-ink: #172033;
    --app-muted: #64748b;
    --app-line: #e2e8f0;
    --app-surface: #ffffff;
    --app-bg: #f3f7fc;
    --app-success: #15803d;
    --app-danger: #b91c1c;
}

body.modern-page {
    margin: 0;
    color: var(--app-ink);
    background:
        radial-gradient(circle at 90% 0, rgba(14, 165, 233, .11), transparent 28rem),
        linear-gradient(180deg, #f8fbff 0, var(--app-bg) 100%);
    min-height: 100vh;
}

.app-header {
    position: relative;
    width: 100%;
    overflow: hidden;
    color: #fff;
    background: linear-gradient(125deg, #0b2550 0%, var(--app-navy) 50%, #155e9a 100%);
    box-shadow: 0 10px 30px rgba(15, 47, 95, .18);
}

.app-header::after {
    content: "";
    position: absolute;
    inset: auto -8% -55px auto;
    width: 250px;
    height: 150px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
}

.app-header__inner {
    position: relative;
    z-index: 1;
    width: min(100% - 2rem, 1280px);
    margin: 0 auto;
    padding: 1.35rem 0 1.1rem;
}

.app-header__title {
    margin: 0;
    font-size: clamp(1.25rem, 3vw, 1.8rem);
    font-weight: 800;
    letter-spacing: -.02em;
}

.app-header__subtitle {
    margin: .45rem 0 0;
    color: #dbeafe;
    font-size: .92rem;
}

.app-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
    margin: 0 0 .9rem;
    padding: 0;
    list-style: none;
    color: #dbeafe;
    font-size: .85rem;
}

.app-breadcrumb::before {
    content: "شما اینجا هستید:";
    color: inherit;
    opacity: .8;
    margin-left: .15rem;
}

.app-breadcrumb li {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.app-breadcrumb li:not(:last-child)::after {
    content: "‹";
    opacity: .7;
    font-size: 1.15rem;
}

.app-breadcrumb a {
    color: #fff;
    text-decoration: none;
    padding: .2rem .38rem;
    border-radius: .45rem;
    transition: background-color .18s ease;
}

.app-breadcrumb a:hover,
.app-breadcrumb a:focus-visible {
    background: rgba(255, 255, 255, .14);
    outline: none;
}

.app-breadcrumb [aria-current="page"] {
    color: #bfdbfe;
}

.app-main {
    width: min(100% - 2rem, 1280px);
    margin: 1.5rem auto 0;
    padding-bottom: 2.5rem;
}

.surface-card {
    border: 1px solid rgba(226, 232, 240, .9);
    border-radius: 1rem;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 10px 30px rgba(15, 23, 42, .07);
}

.surface-card--interactive {
    transition: transform .18s ease, box-shadow .18s ease;
}

.surface-card--interactive:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 36px rgba(15, 23, 42, .10);
}

.section-heading {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin: 0 0 1rem;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--app-navy);
}

.section-heading::before {
    content: "";
    width: .3rem;
    height: 1.35rem;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--app-sky), var(--app-blue));
}

.modern-page input:not([type="checkbox"]):not([type="radio"]),
.modern-page select,
.modern-page textarea {
    border-color: #cbd5e1;
    border-radius: .65rem;
    background-color: #fff;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.modern-page input:not([type="checkbox"]):not([type="radio"]):focus,
.modern-page select:focus,
.modern-page textarea:focus {
    border-color: var(--app-sky);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, .14);
    outline: none;
}

.app-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--app-line);
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .06);
}

.app-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.app-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: #334155;
    background: #eff6ff;
    border-bottom: 1px solid #cbd5e1;
    white-space: nowrap;
}

.app-table tbody tr {
    transition: background-color .15s ease;
}

.app-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

.app-table tbody tr:hover {
    background: #eef6ff;
}

.app-table th,
.app-table td {
    border-left: 0 !important;
    border-right: 0 !important;
    border-top: 0 !important;
    border-bottom: 1px solid #e8eef6 !important;
}

.sort-button {
    display: inline-flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .15rem 0;
    color: inherit;
    font: inherit;
    font-weight: 700;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.sort-button:hover,
.sort-button:focus-visible {
    color: var(--app-blue);
    outline: none;
}

.sort-indicator {
    display: inline-flex;
    min-width: 1rem;
    color: #94a3b8;
}

.sort-button[aria-sort="ascending"] .sort-indicator,
.sort-button[aria-sort="descending"] .sort-indicator {
    color: var(--app-blue);
}

.quick-links {
    display: grid;
    gap: .65rem;
}

.quick-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .8rem .95rem;
    color: #1e3a8a;
    text-decoration: none;
    border: 1px solid #dbeafe;
    border-radius: .75rem;
    background: #f8fbff;
    transition: border-color .18s ease, background-color .18s ease;
}

.quick-link::after {
    content: "←";
    color: var(--app-sky);
}

.quick-link:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}

.detail-toolbar {
    width: min(100% - 2rem, 1240px);
    margin: 1rem auto;
    padding: .85rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    border: 1px solid var(--app-line);
    border-radius: .9rem;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 8px 24px rgba(15, 23, 42, .06);
}

.detail-toolbar__action {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.3rem;
    padding: .5rem .9rem;
    border: 1px solid #1d4ed8;
    border-radius: .7rem;
    background: linear-gradient(135deg, #102f62, #2563eb);
    color: #fff !important;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 5px 14px rgba(30, 64, 175, .18);
}

.detail-toolbar__action:hover,
.detail-toolbar__action:focus-visible {
    background: linear-gradient(135deg, #0b2450, #1d4ed8);
    color: #fff !important;
}

.detail-toolbar .app-breadcrumb {
    margin: 0;
    color: var(--app-muted);
}

.detail-toolbar .app-breadcrumb a {
    color: var(--app-blue);
}

.detail-toolbar .app-breadcrumb [aria-current="page"] {
    color: var(--app-muted);
}

.detail-toolbar .app-breadcrumb a:hover,
.detail-toolbar .app-breadcrumb a:focus-visible {
    background: #eff6ff;
}

.attendance-detail-page {
    overflow-x: auto;
}

.attendance-detail-page #capture-area {
    border: 1px solid var(--app-line);
    border-radius: 1rem;
    box-shadow: 0 14px 38px rgba(15, 23, 42, .10) !important;
}

@media (max-width: 640px) {
    .app-header__inner,
    .app-main {
        width: min(100% - 1rem, 1280px);
    }

    .app-header__inner {
        padding: 1rem 0;
    }

    .app-main {
        margin-top: 1rem;
    }

    .detail-toolbar {
        align-items: stretch;
        flex-direction: column;
    }
}

@media print {
    .app-header,
    .detail-toolbar,
    .no-print {
        display: none !important;
    }
}
