:root {
    --bg-1: #eef4f2;
    --bg-2: #e4eef6;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --primary: #0d9488;
    --primary-2: #059669;
    --primary-soft: #ccfbf1;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --ok: #16a34a;
    --ok-soft: #dcfce7;
    --radius: 16px;
    --shadow: 0 12px 34px rgba(15, 23, 42, .09);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

html, body { margin: 0; padding: 0; max-width: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: linear-gradient(160deg, var(--bg-1), var(--bg-2));
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.muted { color: var(--muted); }
.small { font-size: 13px; }

.logo {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary-2), var(--primary));
    color: #fff;
    font-weight: 800;
    font-size: 26px;
    display: grid;
    place-items: center;
    box-shadow: 0 8px 20px rgba(13, 148, 136, .35);
}
.logo.sm { width: 34px; height: 34px; font-size: 17px; margin: 0; border-radius: 10px; }

.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.login-card {
    width: 100%;
    max-width: 380px;
    text-align: center;
}
.login-card h1 { font-size: 21px; margin: 0 0 6px; }
.login-card .muted { margin: 0 0 22px; }
.login-card label { text-align: left; }

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 26px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 22px;
    background: rgba(255, 255, 255, .82);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; min-width: 0; }
.brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; gap: 8px; flex-shrink: 0; }

.container {
    max-width: 720px;
    margin: 26px auto 60px;
    padding: 0 18px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.field { margin-bottom: 16px; }
label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 7px;
    color: #334155;
}

input[type=text], input[type=password], input[type=date], select, textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: 11px;
    font-size: 15px;
    font-family: inherit;
    background: #fbfdfe;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s, background .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(13, 148, 136, .14);
}
textarea { resize: vertical; }
select {
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 38px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 11px;
    border: 1px solid transparent;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: transform .05s, filter .15s, background .15s, border-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn.primary {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-2), var(--primary));
    color: #fff;
    box-shadow: 0 8px 20px rgba(13, 148, 136, .28);
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.primary:disabled { opacity: .6; cursor: not-allowed; box-shadow: none; }
.btn.ghost {
    background: #f1f5f9;
    color: #334155;
    border-color: var(--border);
    padding: 9px 15px;
    font-size: 14px;
}
.btn.ghost:hover { background: #e8eef4; }

.dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 14px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    background: #f8fbfc;
    transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag {
    border-color: var(--primary);
    background: var(--primary-soft);
}
.dz-icon {
    width: 46px;
    height: 46px;
    margin: 0 auto 10px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--border);
    color: var(--primary);
    font-size: 26px;
    font-weight: 400;
    display: grid;
    place-items: center;
}
.dz-text { font-weight: 600; font-size: 15px; }
.dz-hint { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.link { color: var(--primary); font-weight: 600; cursor: pointer; text-decoration: none; }
.link:hover { text-decoration: underline; }

.preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 10px;
    margin-top: 14px;
}
.thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: 11px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #f1f5f9;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .rm {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(15, 23, 42, .72);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
}
.thumb .rm:hover { background: var(--danger); }

.progress {
    height: 9px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
    margin: 18px 0;
}
.progress .bar {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary-2), var(--primary));
    transition: width .2s;
}
.hidden { display: none !important; }

.actions { margin-top: 6px; }

.alert {
    background: var(--danger-soft);
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 11px;
    padding: 11px 14px;
    font-size: 14px;
    margin-top: 14px;
}
.alert.ok { background: var(--ok-soft); color: #166534; border-color: #bbf7d0; }

.result { margin-top: 18px; display: grid; gap: 8px; }
.result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: 11px;
    font-size: 14px;
    border: 1px solid var(--border);
    background: #f8fafc;
}
.result-item.ok { background: var(--ok-soft); border-color: #bbf7d0; }
.result-item.err { background: var(--danger-soft); border-color: #fecaca; }
.result-item .badge {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 7px;
    border-radius: 6px;
    background: #e2e8f0;
    color: #475569;
    flex-shrink: 0;
}
.result-item.ok .badge { background: #bbf7d0; color: #166534; }
.result-item.err .badge { background: #fecaca; color: #991b1b; }
.result-item .fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    display: grid;
    place-items: center;
    padding: 20px;
    z-index: 50;
}
.modal-card {
    background: #fff;
    border-radius: var(--radius);
    width: 100%;
    max-width: 760px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .3);
}
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-size: 17px; margin: 0; }
.riwayat-list { overflow: auto; padding: 12px 20px 20px; }
.riwayat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f8fafc;
    margin-bottom: 8px;
}
.riwayat-main { flex: 1; min-width: 0; }
.riwayat-name { font-weight: 700; font-size: 15px; color: var(--text); }
.riwayat-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.riwayat-ket { font-size: 14px; margin-top: 5px; overflow-wrap: anywhere; }
.riwayat-badge {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 7px;
    border-radius: 6px;
    background: #e2e8f0;
    color: #475569;
    flex-shrink: 0;
}
.riwayat-badge.drive { background: #bbf7d0; color: #166534; }
.riwayat-list pre {
    margin: 0 0 8px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: #334155;
    line-height: 1.5;
}

@media (max-width: 640px) {
    .container { margin: 16px auto 44px; padding: 0 12px; }
    .card { padding: 18px; border-radius: 14px; }
    .grid-2 { grid-template-columns: 1fr; gap: 0; }

    .topbar { padding: 12px 14px; gap: 10px; }
    .brand { font-size: 15px; }
    .brand-name { max-width: 42vw; }
    .topbar-actions .btn.ghost { padding: 8px 12px; font-size: 13px; }

    input[type=text], input[type=password], input[type=date], select, textarea {
        font-size: 16px;
    }

    .dropzone { padding: 24px 14px; }
    .dz-icon { width: 42px; height: 42px; font-size: 24px; }
    .dz-text { font-size: 14px; }

    .preview { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }

    .result-item { flex-wrap: wrap; }
    .result-item .fname { white-space: normal; overflow-wrap: anywhere; }

    .modal { padding: 12px; }
    .modal-card { max-height: 90vh; border-radius: 14px; }
    .modal-head { padding: 14px 16px; }
    .riwayat-list { padding: 10px 16px 16px; }

    .login-wrap { padding: 16px; }
}

@media (max-width: 360px) {
    .brand-name { max-width: 34vw; }
    .topbar-actions .btn.ghost { padding: 8px 10px; }
    .preview { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
}
