:root {
    --bg: #eef2f7;
    --panel: #ffffff;
    --text: #15314b;
    --muted: #69829a;
    --border: #d7e1ec;
    --primary: #1f4f82;
    --primary-dark: #173a60;
    --success: #1c8f5d;
    --danger: #d64545;
    --warning: #dd9b17;
    --shadow: 0 14px 30px rgba(18, 42, 66, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    background: linear-gradient(180deg, #f7fafc 0%, var(--bg) 100%);
    color: var(--text);
}

a {
    color: var(--primary);
    text-decoration: none;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #15314b 0%, #1f4f82 100%);
    color: #fff;
    padding: 28px 18px;
}

.brand {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 10px;
}

.brand-link {
    display: block;
    margin-bottom: 10px;
}

.brand-logo {
    display: block;
    width: 100%;
    max-width: 210px;
    height: auto;
}

.brand-subtitle,
.user-chip small {
    color: rgba(255, 255, 255, 0.76);
}

.user-chip {
    margin: 22px 0 28px;
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.08);
}

.nav-link {
    display: block;
    padding: 14px 16px;
    margin-bottom: 10px;
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.88);
    font-weight: 600;
}

.nav-link.active,
.nav-link:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.content {
    flex: 1;
    padding: 26px;
}

.card,
.stats-card,
.login-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.page-header {
    padding: 24px 28px;
    margin-bottom: 22px;
}

.page-header h1 {
    margin: 0 0 6px;
    font-size: 30px;
}

.page-header p {
    margin: 0;
    color: var(--muted);
}

.section-grid {
    display: grid;
    gap: 22px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 22px;
}

.stats-card {
    padding: 24px;
}

.stats-card .value {
    margin-top: 10px;
    font-size: 36px;
    font-weight: 700;
}

.layout-two {
    display: grid;
    gap: 22px;
    grid-template-columns: minmax(320px, 1fr) minmax(420px, 2fr);
}

.form-layout-wide {
    grid-template-columns: minmax(340px, 420px) minmax(620px, 1fr);
}

.card-header {
    padding: 22px 24px 0;
}

.card-header h2 {
    margin: 0 0 4px;
}

.card-header p {
    margin: 0;
    color: var(--muted);
}

.card-body {
    padding: 22px 24px 24px;
}

.form-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

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

.field-inline {
    justify-content: flex-end;
}

.field label {
    font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea,
input[type="file"] {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #c8d4df;
    font: inherit;
    background: #fff;
}

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

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.btn {
    appearance: none;
    border: 0;
    border-radius: 12px;
    padding: 12px 18px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-light { background: #eef4f9; color: var(--text); }

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 14px 12px;
    border-bottom: 1px solid #e5edf5;
    text-align: left;
    vertical-align: top;
}

th {
    background: #f5f9fc;
    font-size: 14px;
}

.table-responsive {
    overflow-x: auto;
}

.alert {
    margin-bottom: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    font-weight: 600;
}

.alert-success { background: #e8f8f1; color: #166242; }
.alert-error { background: #fdecec; color: #912b2b; }
.alert-warning { background: #fff6e0; color: #8a6206; }

.login-wrapper {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 30px 16px;
}

.login-card {
    width: min(100%, 540px);
    overflow: hidden;
}

.login-banner {
    background: linear-gradient(135deg, #15314b 0%, #1f4f82 100%);
    padding: 32px;
    color: #fff;
}

.login-logo {
    display: block;
    width: 100%;
    max-width: 260px;
    height: auto;
    margin: 0 0 18px;
}

.login-body {
    padding: 28px 32px 34px;
}

.muted {
    color: var(--muted);
}

.filters {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-bottom: 16px;
}

.badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    background: #edf4fb;
    color: var(--primary);
    font-weight: 700;
    font-size: 13px;
}

.chart-bars {
    display: grid;
    gap: 16px;
}

.chart-row {
    display: grid;
    gap: 12px;
    grid-template-columns: 180px 1fr 60px;
    align-items: center;
}

.bar-track {
    height: 14px;
    border-radius: 999px;
    background: #edf3f8;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #1f4f82 0%, #58a6ff 100%);
}

.datatable-toolbar {
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(260px, 1fr) 180px;
    margin-bottom: 14px;
    align-items: end;
}

.datatable-length {
    max-width: 180px;
}

.datatable-summary {
    margin-bottom: 14px;
    color: var(--muted);
    font-weight: 600;
}

.datatable-pagination {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 20px;
}

.pagination-button {
    min-width: 52px;
    text-align: center;
    padding: 12px 16px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.info-grid div {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #f9fbfd;
}

.status-badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 13px;
}

.status-pending {
    background: #fff1d8;
    color: #8a6206;
}

.status-approved {
    background: #e8f8f1;
    color: #166242;
}

.status-rejected {
    background: #fdecec;
    color: #912b2b;
}

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

.actions-column form {
    display: grid;
    gap: 10px;
}

.leave-form-preview {
    border: 1px solid #101010;
    background: #fff;
    min-height: 980px;
}

.preview-logo-banner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 64px;
    width: 390px;
    padding: 0;
    margin: 18px 0 18px 18px;
}

.preview-logo-image {
    width: 100%;
    max-width: 390px;
    height: auto;
    display: block;
}

.preview-header-grid {
    display: grid;
    grid-template-columns: 90px 1.4fr 110px 170px 160px;
    min-height: 150px;
}

.preview-header-grid > div {
    border-right: 1px solid #101010;
    border-bottom: 1px solid #101010;
    padding: 14px 10px;
}

.preview-header-grid > div:last-child {
    border-right: 0;
}

.preview-center-title,
.preview-form-title,
.preview-sicil-box {
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    gap: 6px;
}

.preview-center-title strong {
    font-size: 19px;
}

.preview-form-title strong {
    font-size: 19px;
}

.preview-sicil-box strong {
    font-size: 15px;
}

.preview-sicil-box span {
    margin-top: 8px;
    font-weight: 700;
}

.preview-row.full {
    display: flex;
    gap: 10px;
    align-items: center;
    min-height: 46px;
    padding: 10px 12px;
    border-bottom: 1px solid #101010;
}

.preview-row.full .label,
.preview-field-row .label {
    font-weight: 700;
}

.preview-split-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.preview-split-header strong {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    border-bottom: 1px solid #101010;
}

.preview-split-header strong:first-child {
    border-right: 1px solid #101010;
}

.preview-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 730px;
}

.preview-left,
.preview-right {
    min-height: 100%;
}

.preview-left {
    border-right: 1px solid #101010;
}

.preview-field-row {
    display: grid;
    grid-template-columns: 170px 1fr;
    min-height: 48px;
    border-bottom: 1px solid #101010;
}

.preview-field-row.tall {
    min-height: 72px;
}

.preview-field-row.address {
    min-height: 90px;
}

.preview-field-row .label,
.preview-field-row span:last-child {
    padding: 12px 10px;
}

.preview-field-row .label {
    border-right: 1px solid #101010;
}

.preview-secretary {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 64px;
    border-bottom: 1px solid #101010;
    color: #101010;
    font-weight: 700;
    font-size: 22px;
}

.preview-petition {
    position: relative;
    min-height: 260px;
    padding: 16px 12px 28px;
}

.preview-note-text {
    color: #101010;
    font-weight: 700;
}

.preview-note-sentence {
    margin: 18px 18px 0;
    font-size: 18px;
    line-height: 1.45;
}

.preview-note-sentence span {
    display: inline-block;
    min-width: 34px;
    text-align: center;
}

.preview-sign {
    position: absolute;
    right: 18px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: center;
}

.preview-right {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-bottom: 42px;
}

.preview-approval-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    text-align: center;
    padding: 0 20px;
}

.preview-approval-block strong {
    font-size: 20px;
}

.preview-approval-block span {
    font-size: 18px;
}

.leave-request-sheet {
    position: relative;
    overflow: hidden;
    background: #fff;
    border: 1px solid #d8e0ea;
    border-radius: 18px;
    box-shadow: inset 0 0 0 1px rgba(21, 49, 75, 0.04);
    padding: 26px 28px 28px;
}

.sheet-watermark {
    position: absolute;
    inset: 80px 0 0 0;
    display: flex;
    justify-content: center;
    pointer-events: none;
    opacity: 0.06;
}

.sheet-watermark img {
    width: 72%;
    height: auto;
    object-fit: contain;
}

.sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 22px;
    position: relative;
    z-index: 1;
}

.sheet-header-logo {
    width: 240px;
    height: auto;
    display: block;
}

.sheet-title-box {
    border: 2px solid #2a3542;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 800;
    text-align: center;
    border-radius: 6px;
    background: #fff;
}

.sheet-top-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.9fr;
    gap: 26px;
    margin-bottom: 22px;
    position: relative;
    z-index: 1;
}

.sheet-meta,
.sheet-company,
.sheet-info,
.sheet-summary,
.sheet-dates {
    display: grid;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.sheet-info {
    margin-bottom: 22px;
}

.sheet-section-title {
    font-size: 13px;
    font-weight: 800;
    margin: 8px 0 12px;
    position: relative;
    z-index: 1;
}

.sheet-summary,
.sheet-dates {
    margin-bottom: 18px;
}

.sheet-line {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-height: 22px;
    position: relative;
    z-index: 1;
}

.sheet-line.compact .sheet-label {
    min-width: 54px;
}

.sheet-label {
    flex: 0 0 auto;
    font-size: 13px;
}

.sheet-dots {
    flex: 1;
    border-bottom: 1px dotted #4f5f6f;
    transform: translateY(-4px);
}

.sheet-value {
    flex: 0 0 auto;
    max-width: 56%;
    font-size: 13px;
    font-weight: 600;
    text-align: right;
}

.sheet-value.multiline {
    text-align: left;
    max-width: 62%;
    line-height: 1.45;
}

.sheet-suffix {
    font-size: 13px;
    min-width: 44px;
}

.sheet-note {
    margin-top: 10px;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.sheet-request-text {
    font-size: 13px;
    margin: 0 0 18px;
    position: relative;
    z-index: 1;
}

.sheet-approval-box {
    border: 1px solid #9eacba;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255,255,255,0.92);
    position: relative;
    z-index: 1;
}

.sheet-approval-head {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    border-bottom: 1px solid #c9d4de;
    background: #f8fbfd;
}

.sheet-approval-head span {
    padding: 12px 10px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
}

.sheet-approval-body {
    display: grid;
    grid-template-columns: 180px 1fr;
    min-height: 92px;
}

.sheet-approval-checks {
    border-right: 1px solid #c9d4de;
    padding: 14px 12px;
    display: grid;
    gap: 10px;
    align-content: center;
    font-size: 13px;
}

.sheet-approval-note {
    padding: 14px 16px;
    font-size: 13px;
    line-height: 1.6;
}

.leave-request-sheet-simple {
    border: 0;
    border-radius: 0;
    padding: 18px;
    box-shadow: none;
}

.sheet-header-simple {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
}

.sheet-header-logo-simple {
    width: 240px;
    height: auto;
    display: block;
}

.sheet-title-box-simple {
    border: 1px solid #1f2937;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 800;
    text-align: center;
    background: #fff;
}

.sheet-details-table-simple {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    margin-bottom: 16px;
}

.sheet-details-table-simple td {
    padding: 7px 0 6px;
    vertical-align: top;
    border-bottom: 1px dotted #4b5563;
}

.sheet-detail-label {
    width: 235px;
    font-weight: 700;
    white-space: normal;
    padding-right: 14px !important;
}

.sheet-detail-value {
    word-break: break-word;
}

.sheet-columns-simple {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border: 1px solid #1f2937;
}

.sheet-left-box,
.sheet-right-box {
    min-height: 300px;
    background: #fff;
}

.sheet-left-box {
    border-right: 1px solid #1f2937;
    padding: 16px 14px 18px;
}

.sheet-left-title {
    font-size: 14px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 22px;
}

.sheet-left-box p {
    line-height: 1.6;
    margin: 0;
}

.sheet-signature {
    margin-top: 80px;
    text-align: right;
    line-height: 1.6;
}

.sheet-right-content {
    padding: 14px 16px 18px;
}

.sheet-right-title {
    font-size: 13px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 16px;
}

.sheet-right-text {
    margin: 0 0 28px;
    line-height: 1.6;
    font-weight: 700;
}

.sheet-meta-group {
    margin-bottom: 12px;
    line-height: 1.4;
}

.sheet-meta-group strong {
    display: block;
    margin-bottom: 4px;
}

@media (max-width: 980px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .layout-two,
    .form-layout-wide,
    .datatable-toolbar {
        grid-template-columns: 1fr;
    }

    .datatable-length {
        max-width: none;
    }

    .preview-header-grid,
    .preview-split-header,
    .preview-columns {
        grid-template-columns: 1fr;
    }

    .preview-left {
        border-right: 0;
        border-bottom: 1px solid #101010;
    }

    .sheet-top-grid,
    .sheet-approval-body,
    .sheet-columns-simple {
        grid-template-columns: 1fr;
    }

    .sheet-approval-checks {
        border-right: 0;
        border-bottom: 1px solid #c9d4de;
    }

    .sheet-left-box {
        border-right: 0;
        border-bottom: 1px solid #1f2937;
    }

    .sheet-header-simple {
        flex-direction: column;
        align-items: flex-start;
    }
}
