:root {
    --bg: #eef2f7;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #172033;
    --muted: #64748b;
    --line: #d8e0ea;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --success-dark: #15803d;
    --danger: #dc2626;
    --danger-dark: #b91c1c;
    --warning: #f59e0b;
    --shadow: 0 18px 45px rgba(15, 23, 42, 0.10);
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
}

body {
    min-height: 100vh;
    margin: 0;
    padding: 24px !important;
    background: linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%) !important;
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

header {
    max-width: 1240px;
    margin: 0 auto 18px !important;
    padding: 24px 28px !important;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 16px;
    background: #172033 !important;
    color: #fff;
    box-shadow: var(--shadow);
    text-align: left !important;
}

h1 {
    margin: 0;
    font-size: clamp(1.45rem, 2.8vw, 2.25rem);
    font-weight: 800;
}

h2,
h3 {
    color: var(--text);
}

main {
    width: min(1240px, 100%);
    margin: 0 auto;
    overflow-x: auto;
}

footer {
    max-width: 1240px;
    margin: 24px auto 0 !important;
    padding: 14px 18px !important;
    border-radius: 14px;
    background: transparent !important;
    color: var(--muted) !important;
    font-size: 0.9rem;
}

.message,
.error {
    width: min(720px, 100%);
    margin: 0 auto 16px !important;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
    color: #166534 !important;
    font-weight: 700;
}

.error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b !important;
}

.total-data {
    display: inline-flex;
    align-items: center;
    margin: 0 0 16px !important;
    padding: 9px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.nav-links {
    display: flex !important;
    align-items: center;
    justify-content: flex-start !important;
    gap: 10px;
    flex-wrap: wrap;
    margin: 0 0 16px !important;
}

a,
button {
    transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

button,
.add-link,
.history-link,
.history-button,
.back-link,
.logout-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 15px !important;
    border: 1px solid transparent !important;
    border-radius: 10px !important;
    color: #fff !important;
    font-weight: 700;
    line-height: 1.1;
    text-decoration: none !important;
    cursor: pointer;
}

button:hover,
.add-link:hover,
.history-link:hover,
.history-button:hover,
.back-link:hover,
.logout-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.14);
}

.add-link,
button[type="submit"] {
    background: var(--success) !important;
}

.add-link:hover,
button[type="submit"]:hover {
    background: var(--success-dark) !important;
}

.history-link,
.history-button,
.back-link,
.edit-btn,
.zoom-btn {
    background: var(--primary) !important;
}

.history-link:hover,
.history-button:hover,
.back-link:hover,
.edit-btn:hover,
.zoom-btn:hover {
    background: var(--primary-dark) !important;
}

.logout-btn,
.delete-btn,
.confirm-delete {
    background: var(--danger) !important;
}

.logout-btn:hover,
.delete-btn:hover,
.confirm-delete:hover {
    background: var(--danger-dark) !important;
}

.history-btn,
.cancel-delete {
    background: #475569 !important;
}

table {
    width: 100%;
    min-width: 980px;
    border-spacing: 0;
    border-collapse: separate !important;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px !important;
    background: var(--surface) !important;
    box-shadow: var(--shadow) !important;
}

th,
td {
    padding: 14px 16px !important;
    border-bottom: 1px solid var(--line) !important;
    color: var(--text);
    vertical-align: middle;
    text-align: left;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-soft) !important;
    color: #334155;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

tbody tr:hover {
    background: #f8fbff;
}

tbody tr:last-child td {
    border-bottom: 0 !important;
}

.actions {
    display: flex !important;
    align-items: center;
    gap: 8px !important;
    flex-wrap: wrap;
}

.actions br {
    display: none;
}

.actions button {
    min-width: 76px !important;
    min-height: 36px;
    padding: 8px 12px !important;
    font-size: 0.9rem !important;
}

.thumbnail,
.current-photo {
    width: 92px;
    height: 68px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
    object-fit: cover;
}

.clickable-photo,
.photo-preview img {
    cursor: zoom-in;
}

.clickable-photo:hover,
.photo-preview img:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.18);
}

.photo-preview {
    display: grid;
    gap: 10px;
    margin: -4px 0 16px;
    padding: 12px;
    border: 1px dashed #94a3b8;
    border-radius: 12px;
    background: #f8fafc;
}

.photo-preview[hidden] {
    display: none;
}

.photo-preview span {
    color: #334155;
    font-size: 0.9rem;
    font-weight: 800;
}

.photo-preview img {
    width: 180px !important;
    max-width: 100%;
    height: 128px;
    max-height: 128px !important;
    border-radius: 12px;
    border: 1px solid var(--line);
    object-fit: cover;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
}

.empty-photo {
    margin: 0 0 16px;
    padding: 12px;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
    color: var(--muted);
    font-weight: 700;
}

form,
.login-container,
.delete-modal-content {
    width: min(640px, 100%);
    margin: 0 auto !important;
    padding: 28px !important;
    border: 1px solid var(--line);
    border-radius: 16px !important;
    background: var(--surface) !important;
    box-shadow: var(--shadow) !important;
}

.login-container {
    max-width: 420px !important;
}

.login-container h2 {
    margin: 0 0 20px;
    font-size: 1.65rem !important;
}

label {
    display: block;
    margin: 0 0 7px !important;
    color: #334155;
    font-size: 0.92rem;
    font-weight: 800 !important;
}

input,
textarea {
    width: 100%;
    margin: 0 0 16px !important;
    padding: 11px 12px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 10px !important;
    background: #fff;
    color: var(--text);
    font: inherit;
}

input:focus,
textarea:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
    outline: 0;
}

input[readonly] {
    background: var(--surface-soft);
    color: var(--muted);
}

input[type="file"] {
    padding: 9px !important;
}

form button[type="submit"] {
    width: auto !important;
    min-width: 140px;
}

.page-zoom-controls {
    position: absolute;
    top: 18px !important;
    right: 22px;
    left: auto !important;
    display: flex;
    gap: 8px;
}

.zoom-btn {
    min-width: 42px;
    padding: 8px 12px !important;
    border-color: rgba(255, 255, 255, 0.35) !important;
}

.modal,
.delete-modal {
    z-index: 1000 !important;
    background-color: rgba(15, 23, 42, 0.82) !important;
    backdrop-filter: blur(4px);
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 28px;
    overflow: auto;
    align-items: center;
    justify-content: center;
}

.modal-content {
    display: block;
    width: auto;
    max-width: min(920px, calc(100vw - 56px));
    max-height: calc(100vh - 56px);
    margin: 0 auto;
    border-radius: 14px;
    object-fit: contain;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.36);
}

.close {
    position: fixed !important;
    top: 18px !important;
    right: 18px !important;
    z-index: 1001;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.75);
    text-align: center;
    line-height: 42px;
}

@media (max-width: 768px) {
    body {
        padding: 14px !important;
    }

    header {
        padding: 20px !important;
        border-radius: 14px;
    }

    main {
        overflow-x: visible;
    }

    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
        min-width: 0;
    }

    table {
        border: 0;
        background: transparent !important;
        box-shadow: none !important;
    }

    thead,
    th {
        display: none;
    }

    tr {
        margin-bottom: 14px !important;
        overflow: hidden;
        border: 1px solid var(--line) !important;
        border-radius: 14px !important;
        background: var(--surface);
        box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
    }

    td {
        display: grid !important;
        grid-template-columns: minmax(120px, 42%) 1fr;
        gap: 12px;
        min-height: 44px;
        padding: 11px 14px !important;
        border-bottom: 1px solid var(--line) !important;
    }

    td:before {
        position: static !important;
        content: attr(data-label);
        color: var(--muted);
        font-weight: 800;
    }

    td:last-child {
        border-bottom: 0 !important;
    }

    .actions {
        justify-content: flex-start !important;
        padding: 0 !important;
    }

    form,
    .login-container,
    .delete-modal-content {
        padding: 20px !important;
    }

    form button[type="submit"],
    .nav-links > *,
    .actions button {
        width: 100% !important;
    }

    .page-zoom-controls {
        position: static;
        margin-top: 14px;
    }
}

/* Modern dashboard refresh */
body {
    position: relative;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(238, 242, 247, 0.98)),
        repeating-linear-gradient(90deg, rgba(148, 163, 184, 0.14) 0, rgba(148, 163, 184, 0.14) 1px, transparent 1px, transparent 80px) !important;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: repeating-linear-gradient(0deg, rgba(148, 163, 184, 0.10) 0, rgba(148, 163, 184, 0.10) 1px, transparent 1px, transparent 80px);
}

body > * {
    position: relative;
    z-index: 1;
}

header {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    min-height: 116px;
    overflow: hidden;
    background: linear-gradient(135deg, #172033 0%, #1f3a3d 58%, #0f766e 140%) !important;
}

header::after {
    content: "";
    position: absolute;
    right: 28px;
    bottom: 0;
    left: 28px;
    height: 4px;
    border-radius: 999px 999px 0 0;
    background: linear-gradient(90deg, #2dd4bf, #f59e0b, #60a5fa);
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    margin-bottom: 8px;
    padding: 5px 10px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.10);
    color: #ccfbf1;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.page-admin .eyebrow {
    color: #fef3c7;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin: 0 0 18px;
    padding: 14px;
    border: 1px solid rgba(216, 224, 234, 0.9);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(10px);
}

.form-toolbar {
    width: min(640px, 100%);
    margin-right: auto;
    margin-left: auto;
}

.toolbar .total-data {
    margin: 0 !important;
}

.toolbar .nav-links {
    margin: 0 !important;
}

button,
.add-link,
.history-link,
.history-button,
.back-link,
.logout-btn {
    gap: 8px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.10);
}

.add-link::before,
.history-link::before,
.history-button::before,
.back-link::before,
.logout-btn::before,
.edit-btn::before,
.history-btn::before {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 0.78rem;
    font-weight: 900;
}

.add-link::before {
    content: "+";
}

.history-link::before,
.history-button::before,
.history-btn::before {
    content: "i";
}

.back-link::before {
    content: "<";
}

.logout-btn::before {
    content: "x";
}

.edit-btn::before {
    content: "/";
}

table {
    border-color: rgba(203, 213, 225, 0.95);
}

th {
    background: #eef6f5 !important;
    color: #224047;
}

tbody tr:nth-child(even) {
    background: #fbfdff;
}

td:first-child {
    color: #0f766e;
    font-weight: 800;
}

td[data-label="Keterangan"] {
    max-width: 260px;
}

.thumbnail,
.current-photo {
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
}

form,
.login-container,
.delete-modal-content {
    border-color: rgba(203, 213, 225, 0.95);
}

form::before,
.login-container::before {
    content: "";
    display: block;
    width: 54px;
    height: 4px;
    margin-bottom: 20px;
    border-radius: 999px;
    background: linear-gradient(90deg, #0f766e, #f59e0b);
}

.login-container::before {
    display: none;
}

.brand-mark {
    display: grid;
    width: 54px;
    height: 54px;
    margin: 0 auto 14px;
    place-items: center;
    border-radius: 16px;
    background: linear-gradient(135deg, #0f766e, #2563eb);
    color: #fff;
    font-weight: 900;
    box-shadow: 0 18px 34px rgba(15, 118, 110, 0.26);
}

.page-login {
    align-items: center !important;
    padding: 24px !important;
}

.page-login .eyebrow {
    justify-content: center;
    margin-right: auto;
    margin-left: auto;
    color: #0f766e;
    border-color: rgba(15, 118, 110, 0.18);
    background: rgba(15, 118, 110, 0.08);
}

.page-login h2 {
    color: var(--text);
}

@media (max-width: 768px) {
    header {
        align-items: flex-start;
        min-height: 0;
        flex-direction: column;
    }

    .toolbar {
        align-items: stretch;
    }

    td[data-label="Keterangan"] {
        max-width: none;
    }

    td:first-child {
        color: var(--text);
    }
}
