:root {
    --bg: #f6f8fc;
    --surface: #ffffff;
    --text: #14161b;
    --text-muted: #6b6f7b;
    --border: #e7eaf1;
    --accent: #0868e0;
    --accent-hover: #0757bf;
    --accent-text: #ffffff;
    --brand-yellow: #f8a800;
    --brand-orange: #f0a008;
    --success: #16a34a;
    --danger: #dc2626;
    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 1px 2px rgba(20,30,60,0.04), 0 10px 28px rgba(20,30,60,0.07);
    --font-display: "Fredoka", "Baloo 2", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0d0f14;
        --surface: #181b22;
        --text: #f2f3f5;
        --text-muted: #9498a3;
        --border: #2a2e38;
        --accent: #3f8cff;
        --accent-hover: #5c9fff;
        --accent-text: #ffffff;
        --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 10px 28px rgba(0,0,0,0.45);
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.kd-wrap {
    max-width: 640px;
    margin: 0 auto;
    padding: 32px 20px 80px;
    min-height: 100vh;
}

.kd-header {
    text-align: center;
    margin-bottom: 24px;
}

.kd-header a {
    display: inline-block;
    text-decoration: none;
    transition: opacity 0.15s ease;
}
.kd-header a:hover { opacity: 0.85; }

.kd-logo-img {
    height: 76px;
    width: auto;
    display: block;
    margin: 0 auto;
}

.kd-logo-dark { display: none; }

@media (prefers-color-scheme: dark) {
    .kd-logo-light { display: none; }
    .kd-logo-dark { display: block; }
}

.kd-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 8px;
    font-family: var(--font-display);
    font-weight: 500;
}

.kd-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 16px;
    position: relative;
}



.kd-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.kd-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-muted);
    font-family: var(--font-display);
    font-weight: 500;
}

.kd-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}

.kd-status-dot.connected { background: var(--success); box-shadow: 0 0 0 3px rgba(22,163,74,0.15); }
.kd-status-dot.pending { background: #d97706; box-shadow: 0 0 0 3px rgba(217,119,6,0.15); }
.kd-status-dot.fail { background: var(--danger); box-shadow: 0 0 0 3px rgba(220,38,38,0.15); }

.kd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--accent);
    color: var(--accent-text) !important;
    border: none;
    border-radius: var(--radius-sm);
    padding: 13px 22px;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.1s ease, opacity 0.15s ease, background 0.15s ease;
    width: 100%;
}

.kd-btn:hover { background: var(--accent-hover); }
.kd-btn:active { transform: scale(0.98); }
.kd-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.kd-btn-secondary {
    background: transparent;
    color: var(--text) !important;
    border: 1px solid var(--border);
}

.kd-btn-danger {
    background: var(--danger);
    color: #ffffff !important;
}

.kd-btn-row { display: flex; gap: 10px; margin-top: 10px; }
.kd-btn-row .kd-btn { width: auto; flex: 1; }

.kd-dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 44px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    color: var(--text-muted);
}

.kd-dropzone.dragover {
    border-color: var(--accent);
    background: rgba(8,104,224,0.06);
    color: var(--text);
}

.kd-dropzone-icon { margin-bottom: 12px; display: flex; align-items: center; justify-content: center; }
.kd-dropzone-icon svg { width: 46px; height: 46px; }
.kd-dropzone-title { font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.kd-dropzone-sub { font-size: 13px; }

.kd-qr-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 8px 0 4px;
}

.kd-qr-box img, .kd-qr-box canvas, .kd-qr-box table { border-radius: 12px; background: #fff; padding: 12px; }

.kd-magic-link {
    font-size: 12px;
    color: var(--text-muted);
    word-break: break-all;
    text-align: center;
    background: var(--bg);
    border-radius: 8px;
    padding: 8px 12px;
    max-width: 100%;
}

.kd-pair-note {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    max-width: 320px;
    margin: 10px auto 0;
    line-height: 1.5;
}
.kd-pair-note strong { color: var(--text); }

.kd-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 16px;
}

.kd-transfer-list { margin-top: 8px; }

.kd-transfer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.kd-transfer-item:last-child { border-bottom: none; }

.kd-file-icon { font-size: 24px; flex-shrink: 0; }

.kd-staging-area { margin-top: 14px; }
.kd-staging-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; max-height: 260px; overflow-y: auto; }
.kd-staging-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.kd-staging-item .kd-file-icon { font-size: 20px; }
.kd-staging-item-info { flex: 1; min-width: 0; }
.kd-staging-item-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kd-staging-item-size { font-size: 11px; color: var(--text-muted); }
.kd-staging-item-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 15px;
    padding: 4px 6px;
    flex-shrink: 0;
}
.kd-staging-actions { display: flex; gap: 10px; }
.kd-staging-actions #kd-staging-send-btn { flex: 1; }

.kd-persistent-badge {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    background: rgba(8,104,224,0.08);
    padding: 6px 12px;
    border-radius: 100px;
    margin-bottom: 8px;
}

.kd-transfer-info { flex: 1; min-width: 0; }
.kd-transfer-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kd-transfer-meta { font-size: 12px; color: var(--text-muted); }

.kd-progress-track {
    height: 5px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 6px;
}
.kd-progress-fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.15s ease;
}

.kd-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 100px;
    flex-shrink: 0;
}
.kd-badge.ok { background: rgba(22,163,74,0.12); color: var(--success); }
.kd-badge.fail { background: rgba(220,38,38,0.12); color: var(--danger); }

.kd-accept-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.kd-received-card {
    text-align: center;
    padding: 36px 20px;
}
.kd-received-icon { font-size: 48px; margin-bottom: 14px; }
.kd-received-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 8px; }
.kd-received-name { font-size: 18px; font-weight: 600; word-break: break-word; }
.kd-received-size { font-size: 13px; color: var(--text-muted); margin-top: 4px; margin-bottom: 20px; }

.kd-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex; align-items: flex-end; justify-content: center;
    z-index: 100;
    padding: 0;
}
@media (min-width: 600px) {
    .kd-modal-overlay { align-items: center; }
}
.kd-modal {
    background: var(--surface);
    border-radius: 20px 20px 0 0;
    padding: 22px;
    width: 100%;
    max-width: 480px;
}
@media (min-width: 600px) {
    .kd-modal { border-radius: var(--radius); }
}
.kd-modal h3 { margin: 0 0 14px; font-size: 16px; }
.kd-modal textarea, .kd-modal input[type="url"], .kd-modal input[type="text"] {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 14px;
    font-family: inherit;
    background: var(--bg);
    color: var(--text);
    resize: vertical;
}
.kd-modal textarea { min-height: 120px; }

.kd-share-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.kd-share-btn {
    width: 44px; height: 44px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    font-size: 18px;
    cursor: pointer;
}

.kd-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: var(--bg);
    padding: 10px 18px;
    border-radius: 100px;
    font-size: 13px;
    z-index: 200;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    max-width: 90%;
    text-align: center;
}
.kd-toast.show { opacity: 1; }

.kd-footer-links {
    text-align: center;
    margin-top: 32px;
    font-size: 12px;
    color: var(--text-muted);
}
.kd-footer-links a { color: var(--text-muted); }

.kd-footer-brand {
    text-align: center;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
}
.kd-footer-brand a { color: var(--accent); text-decoration: none; font-weight: 600; }
.kd-footer-brand a:hover { text-decoration: underline; }

.kd-footer-credit {
    text-align: center;
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0.75;
}
.kd-footer-credit a { color: var(--text-muted); text-decoration: none; }
.kd-footer-credit a:hover { text-decoration: underline; }

.kd-install-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 13px;
    font-family: var(--font-display);
    font-weight: 500;
}

.kd-install-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.kd-install-dismiss {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 15px;
    padding: 4px 6px;
    line-height: 1;
}

.kd-consent-banner {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 16px 20px;
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    z-index: 300;
    font-size: 13px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}
.kd-consent-banner p { margin: 0; max-width: 480px; color: var(--text-muted); }
.kd-consent-banner .kd-btn { width: auto; padding: 10px 18px; }

.kd-hidden { display: none !important; }

.kd-error-banner {
    background: rgba(220,38,38,0.1);
    color: var(--danger);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 13px;
    margin-bottom: 14px;
}

/* ---------- Lokalni prenos (bez interneta) — ručna razmena ---------- */

.kd-local-field-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin: 10px 0 6px;
}
.kd-local-blob {
    width: 100%;
    min-height: 70px;
    max-height: 140px;
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    line-height: 1.5;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    word-break: break-all;
    box-sizing: border-box;
}
.kd-local-blob:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

#kd-local-offer-qr svg, #kd-local-answer-qr svg { width: 100%; max-width: 300px; height: auto; background: #fff; border-radius: 8px; padding: 6px; box-sizing: content-box; }
.kd-autosend { display: block; font-size: 12px; color: var(--text-muted); margin: 8px 2px 0; cursor: pointer; }
.kd-autosend input { margin-right: 6px; vertical-align: middle; }
.kd-short-code-wrap { text-align: center; margin-top: 6px; }
.kd-short-code-label { font-size: 12px; color: var(--text-muted); }
.kd-short-code { font-family: var(--font-display); font-size: 34px; font-weight: 700; letter-spacing: 0.12em; color: var(--accent); }
.kd-code-entry { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.kd-code-entry label { font-size: 12px; color: var(--text-muted); display: block; margin-bottom: 6px; }
.kd-code-entry-row { display: flex; gap: 8px; }
.kd-code-entry-row input { flex: 1; min-width: 0; font-size: 20px; letter-spacing: 0.15em; text-align: center; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); }
details.kd-local-manual { margin-top: 10px; font-size: 12px; color: var(--text-muted); }
details.kd-local-manual summary { cursor: pointer; padding: 4px 0; }
.kd-btn-row .kd-btn.kd-hidden { display: none; }

/* ---------- Trajna veza — notice / dedicated page ---------- */

.kd-persistent-notice {
    background: rgba(248,168,0,0.1);
    border: 1px solid rgba(248,168,0,0.35);
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    margin-bottom: 18px;
}
.kd-persistent-notice-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.kd-persistent-notice p {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}
.kd-persistent-notice p + p { margin-top: 8px; }
.kd-persistent-notice strong { color: var(--text); }

.kd-persistent-page-link {
    display: block;
    text-align: center;
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 12px;
}
.kd-persistent-page-link a { color: var(--accent); text-decoration: none; font-weight: 600; }
.kd-persistent-page-link a:hover { text-decoration: underline; }

.kd-back-link {
    display: inline-block;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 14px;
}
.kd-back-link:hover { color: var(--accent); }

.kd-legal { line-height: 1.7; font-size: 14px; }
.kd-legal h1, .kd-legal h2 { font-family: var(--font-display); }
.kd-legal h2 { font-size: 17px; margin-top: 28px; }

.kd-modal h3, .kd-received-title, .kd-dropzone-title { font-family: var(--font-display); }
.kd-device-label, #kd-device-label { font-family: var(--font-display); }

/* ---------- Link Drop ---------- */

.kd-mode-toggle {
    display: flex;
    gap: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 4px;
    margin-bottom: 16px;
}

.kd-mode-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 14px;
    padding: 10px 14px;
    border-radius: 100px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.kd-mode-btn.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
}

.kd-link-input-row {
    position: relative;
}

.kd-link-input-row input[type="url"] {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 44px 14px 14px;
    font-size: 14px;
    font-family: inherit;
    background: var(--bg);
    color: var(--text);
}

.kd-link-provider-badge {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    pointer-events: none;
}

.kd-provider-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    min-height: 16px;
}

.kd-drop-created {
    text-align: center;
    padding: 8px 0 4px;
}

.kd-drop-created-icon { font-size: 40px; margin-bottom: 10px; }

/* ---------- Drop stranica (/drop/{token}) ---------- */

.kd-embed-wrap {
    position: relative;
    width: 100%;
    margin: 0 auto;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #000;
}
.kd-embed-wrap iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
.kd-embed-horizontal { aspect-ratio: 16 / 9; }
.kd-embed-vertical { aspect-ratio: 9 / 16; max-width: 380px; }

.kd-embed-social {
    display: flex;
    justify-content: center;
    max-width: 100%;
    overflow-x: auto;
}

.kd-drop-thumbnail {
    width: 100%;
    border-radius: var(--radius-sm);
    display: block;
    margin-bottom: 4px;
}

.kd-drop-meta { padding-top: 14px; }
.kd-drop-provider {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}
.kd-drop-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.kd-drop-author { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.kd-drop-description { font-size: 14px; color: var(--text-muted); line-height: 1.5; }
