* {
    box-sizing: border-box;
}

:root {
    --primary: #0f766e;
    --primary-dark: #115e59;
    --blue: #2563eb;
    --red: #dc2626;
    --slate: #64748b;
    --bg: #f4f7fb;
    --text: #1f2937;
    --muted: #64748b;
    --border: #e5e7eb;
    --soft: #f8fafc;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-text-size-adjust: 100%;
}

.container {
    width: 94%;
    max-width: 1200px;
    margin: 24px auto;
}

.header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #ffffff;
    padding: 24px;
    border-radius: 16px;
    margin-bottom: 20px;
    box-shadow: 0 8px 24px rgba(15, 118, 110, 0.18);
}

.header h1 {
    margin: 0 0 6px;
    font-size: 26px;
    line-height: 1.25;
}

.header p {
    margin: 0;
    opacity: 0.92;
    line-height: 1.5;
}

.card {
    background: #ffffff;
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 18px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    border: 1px solid var(--border);
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 14px;
}

.section-title h2 {
    margin: 0;
    font-size: 20px;
    line-height: 1.3;
}

.section-title span {
    color: var(--muted);
    font-size: 13px;
    text-align: right;
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    align-items: end;
}

label {
    display: block;
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 6px;
    color: #374151;
    line-height: 1.35;
}

input,
select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    font-size: 14px;
    background: #ffffff;
    outline: none;
}

input:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 14px;
    border: none;
    border-radius: 12px;
    background: var(--primary);
    color: #ffffff;
    text-decoration: none;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    line-height: 1.2;
    white-space: nowrap;
}

button:hover,
.btn:hover {
    background: #0d5f59;
}

.btn-secondary {
    background: var(--blue);
}

.btn-secondary:hover {
    background: #1d4ed8;
}

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

.btn-danger:hover {
    background: #b91c1c;
}

.btn-muted {
    background: var(--slate);
}

.btn-muted:hover {
    background: #475569;
}

.form-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.alert {
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-weight: 700;
    line-height: 1.45;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    overflow-wrap: anywhere;
}

.stat {
    background: var(--soft);
    border-radius: 14px;
    padding: 16px;
    border: 1px solid #e2e8f0;
}

.stat .label {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 8px;
}

.stat .value {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.15;
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
}

th,
td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: 14px;
    vertical-align: middle;
}

th {
    background: #f1f5f9;
    color: #334155;
    font-size: 13px;
    text-transform: uppercase;
    white-space: nowrap;
}

tr:hover td {
    background: var(--soft);
}

.actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.export-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto auto auto;
    gap: 10px;
    align-items: end;
}

.footer-note {
    color: var(--muted);
    font-size: 13px;
    text-align: center;
    margin: 18px 0;
}

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

    .export-row {
        grid-template-columns: 1fr 1fr;
    }

    .full-mobile {
        width: 100%;
    }
}

@media (max-width: 640px) {
    body {
        background: #eef3f8;
    }

    .container {
        width: 100%;
        margin: 0;
        padding: 10px;
    }

    .header {
        border-radius: 14px;
        padding: 18px;
        margin-bottom: 12px;
    }

    .header h1 {
        font-size: 21px;
    }

    .header p {
        font-size: 14px;
    }

    .card {
        border-radius: 14px;
        padding: 14px;
        margin-bottom: 12px;
    }

    .section-title {
        display: block;
        margin-bottom: 12px;
    }

    .section-title h2 {
        font-size: 18px;
        margin-bottom: 4px;
    }

    .section-title span {
        display: block;
        text-align: left;
        font-size: 12px;
    }

    .grid,
    .form-grid,
    .export-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat {
        padding: 14px;
    }

    .stat .value {
        font-size: 23px;
    }

    .form-actions,
    .actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    button,
    .btn {
        width: 100%;
        min-height: 44px;
        padding: 11px 12px;
    }

    .table-wrap {
        overflow: visible;
    }

    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
    }

    thead {
        display: none;
    }

    tbody tr {
        background: #ffffff;
        border: 1px solid var(--border);
        border-radius: 14px;
        margin-bottom: 12px;
        padding: 10px;
        box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
    }

    tbody tr:hover td {
        background: transparent;
    }

    td {
        border-bottom: 1px dashed #e2e8f0;
        display: grid;
        grid-template-columns: 46% 54%;
        gap: 8px;
        padding: 9px 4px;
        font-size: 14px;
        word-break: break-word;
    }

    td:last-child {
        border-bottom: none;
    }

    td::before {
        content: attr(data-label);
        font-weight: 700;
        color: #475569;
    }

    td[colspan] {
        display: block;
        text-align: center !important;
        border-bottom: none;
        padding: 14px;
    }

    td[colspan]::before {
        content: "";
    }

    td[data-label="Aksi"] {
        display: block;
    }

    td[data-label="Aksi"]::before {
        display: block;
        margin-bottom: 8px;
    }
}

@media (max-width: 380px) {
    .container {
        padding: 8px;
    }

    td {
        grid-template-columns: 1fr;
        gap: 3px;
    }

    td::before {
        font-size: 12px;
    }
}


/* === SECURITY UPDATE UI === */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 12px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.topbar-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.inline-delete-form {
    margin: 0;
}

.inline-delete-form button {
    width: auto;
}

.login-page {
    background: linear-gradient(135deg, #0f766e, #0f172a);
    min-height: 100vh;
}

.login-shell {
    width: 94%;
    max-width: 420px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 0;
}

.login-card {
    width: 100%;
    background: #ffffff;
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.22);
}

.login-title h1 {
    margin: 0 0 6px;
    font-size: 24px;
    color: #0f766e;
}

.login-title p {
    margin: 0 0 18px;
    color: #64748b;
    line-height: 1.5;
}

.form-control {
    margin-bottom: 12px;
}

.login-help {
    margin-top: 16px;
    padding: 12px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    font-size: 13px;
    color: #475569;
    line-height: 1.5;
}

.narrow-container {
    max-width: 560px;
}

.single-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (max-width: 640px) {
    .topbar {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .inline-delete-form button {
        width: 100%;
    }
}
