/* Jobkera Link Shortener — admin + public styles.
   Layout mirrors the reference product; branding is Jobkera:
   blue→cyan gradient accent (#0b5fa5 → #06b6d4), orange highlight (#ff9800),
   green reserved for Refresh/success actions (#22c55e). */

:root {
    --jk-blue: #0b5fa5;
    --jk-cyan: #06b6d4;
    --jk-grad: linear-gradient(90deg, #0b5fa5, #06b6d4);
    --jk-orange: #ff9800;
    --jk-green: #22c55e;
    --jk-ink: #1d2327;
    --jk-grey: #646970;
    --jk-line: #dcdcde;
    --jk-bg: #f0f0f1;
    --jk-sidebar: #1d2327;
    --jk-radius: 6px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    color: var(--jk-ink);
    background: var(--jk-bg);
}

a { color: var(--jk-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 23px; margin: 0 0 14px; }
h2 { font-size: 16px; margin: 0; }
h3 { font-size: 14px; margin: 18px 0 8px; }

/* ---------- Logo ---------- */
.jk-logo { display: inline-flex; align-items: center; gap: 8px; }
.jk-logo-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 8px;
    background: var(--jk-grad); color: #fff; font-weight: 800; font-size: 18px;
    position: relative;
}
.jk-logo-mark::after {
    content: ""; position: absolute; right: -3px; top: -3px;
    width: 9px; height: 9px; background: var(--jk-orange);
    clip-path: polygon(0 100%, 100% 0, 100% 100%);
}
.jk-logo-text { font-size: 19px; font-weight: 700; color: inherit; }
.jk-logo-sub { display: block; font-size: 11px; color: #a7aaad; margin: 4px 0 0 38px; }

/* ---------- Admin shell ---------- */
.jk-shell { display: flex; min-height: 100vh; }
.jk-sidebar {
    width: 200px; flex: 0 0 200px; background: var(--jk-sidebar); color: #fff;
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.jk-brand { padding: 16px 16px 10px; color: #fff; }
.jk-nav { display: flex; flex-direction: column; padding: 8px 0; flex: 1; }
.jk-nav-item { padding: 9px 16px; color: #dcdcde; font-size: 14px; }
.jk-nav-item:hover { color: #fff; text-decoration: none; background: #2c3338; }
.jk-nav-active { background: var(--jk-grad); color: #fff; font-weight: 600; }
.jk-nav-active:hover { background: var(--jk-grad); }
.jk-sidebar-foot { padding: 12px 16px; font-size: 12px; color: #a7aaad; border-top: 1px solid #3c434a; }

.jk-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.jk-topbar {
    background: #fff; border-bottom: 1px solid var(--jk-line);
    padding: 10px 22px; display: flex; justify-content: space-between; align-items: center;
}
.jk-topbar-title { font-weight: 600; }
.jk-toplink { margin-left: 16px; font-size: 13px; }
.jk-content { padding: 20px 22px; flex: 1; }
.jk-footer { padding: 14px 22px; color: var(--jk-grey); font-size: 12px; }

.jk-page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.jk-page-head h1 { margin: 0; }
.jk-head-actions { display: inline-flex; gap: 8px; align-items: center; }
.jk-create-wrap { position: relative; display: inline-block; }
.jk-menu {
    position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--jk-line);
    border-radius: var(--jk-radius); box-shadow: 0 8px 24px rgba(0,0,0,.13); min-width: 160px; z-index: 30;
    padding: 6px 0;
}
.jk-menu a { display: block; padding: 8px 14px; color: var(--jk-ink); }
.jk-menu a:hover { background: #f6f7f7; text-decoration: none; }

/* ---------- Buttons ---------- */
.jk-btn {
    display: inline-block; border: 1px solid transparent; border-radius: 5px;
    padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
    background: #fff; color: var(--jk-ink); line-height: 1.4;
}
.jk-btn:hover { text-decoration: none; filter: brightness(0.97); }
.jk-btn-primary { background: var(--jk-grad); color: #fff; }
.jk-btn-green { background: var(--jk-green); color: #fff; }
.jk-btn-outline { background: #fff; border-color: var(--jk-blue); color: var(--jk-blue); }
.jk-btn-secondary { background: #fff; border-color: #c3c4c7; color: var(--jk-ink); }
.jk-btn-block { display: block; width: 100%; text-align: center; }
.jk-linklike {
    background: none; border: none; padding: 0; font: inherit; font-size: 12px;
    color: var(--jk-blue); cursor: pointer;
}
.jk-linklike:hover { text-decoration: underline; }
.jk-danger { color: #b32d2e; }
.jk-cancel-link { color: var(--jk-blue); font-size: 13px; }

/* ---------- Alerts ---------- */
.jk-alert { border-radius: var(--jk-radius); padding: 10px 14px; margin: 0 0 14px; font-size: 13px; }
.jk-alert-success { background: #e8f5e9; border: 1px solid #a5d6a7; color: #1b5e20; }
.jk-alert-error { background: #fdecea; border: 1px solid #f5c6c2; color: #7a1f1d; }

/* ---------- Cards / tables ---------- */
.jk-card {
    background: #fff; border: 1px solid var(--jk-line); border-radius: var(--jk-radius);
    padding: 16px 18px; margin-bottom: 18px;
}
.jk-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.jk-muted { color: var(--jk-grey); font-size: 13px; }
.jk-badge {
    display: inline-block; background: #e8f4fd; color: var(--jk-blue); border-radius: 9px;
    font-size: 11px; padding: 1px 7px; font-weight: 600;
}
.jk-empty-box {
    background: #eef4f8; border-radius: var(--jk-radius); color: var(--jk-grey);
    text-align: center; padding: 34px 10px; font-size: 13px;
}

.jk-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.jk-stat-card {
    background: #fff; border: 1px solid var(--jk-line); border-radius: 12px;
    padding: 16px; display: flex; flex-direction: column; gap: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.jk-stat-icon {
    width: 36px; height: 36px; border-radius: 8px; background: var(--jk-grad);
    color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 17px;
}
.jk-stat-label { color: var(--jk-grey); font-size: 12px; margin-top: 6px; }
.jk-stat-value { font-size: 28px; font-weight: 700; }

.jk-table { width: 100%; border-collapse: collapse; background: #fff; font-size: 13px; }
.jk-table th {
    text-align: left; font-weight: 700; color: #2c3338; padding: 9px 10px;
    border-bottom: 1px solid #c3c4c7; white-space: nowrap;
}
.jk-table td { padding: 9px 10px; border-bottom: 1px solid #eeeeef; vertical-align: top; }
.jk-table tbody tr:hover { background: #f6f7f7; }
.jk-mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.jk-mini-table td { padding: 5px 2px; border-bottom: 1px solid #f0f0f1; }
.jk-num { text-align: right; font-weight: 600; }
.jk-dim-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.jk-dim-card { margin-bottom: 18px; }

.jk-table-tools { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 10px; flex-wrap: wrap; }
.jk-tools-right { margin-left: auto; display: inline-flex; gap: 6px; align-items: center; }
input[type="search"], input[type="text"], input[type="url"], input[type="email"],
input[type="password"], input[type="number"], input[type="datetime-local"],
select, textarea {
    border: 1px solid #c3c4c7; border-radius: 4px; padding: 6px 8px; font-size: 13px; background: #fff;
}

/* ---------- Chart / heatmap ---------- */
.jk-chart-legend { display: flex; gap: 14px; margin-bottom: 4px; }
.jk-legend-btn { background: none; border: none; font-size: 12px; cursor: pointer; color: var(--jk-ink); display: inline-flex; gap: 6px; align-items: center; }
.jk-legend-btn.jk-off { opacity: .35; }
.jk-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.jk-series-off { display: none; }
.jk-heatmap { display: flex; gap: 3px; overflow-x: auto; padding: 4px 0; }
.jk-heat-week { display: flex; flex-direction: column; gap: 3px; }
.jk-heat-cell { width: 11px; height: 11px; border-radius: 2px; display: inline-block; background: #ebedef; }
.jk-heat-future { background: transparent; }
.jk-heat-legend { display: flex; align-items: center; gap: 3px; color: var(--jk-grey); font-size: 11px; margin-top: 6px; }

/* ---------- Links list ---------- */
.jk-filterbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.jk-bulkbar { display: flex; gap: 8px; align-items: center; padding: 8px 0; flex-wrap: wrap; }
.jk-links-table { border: 1px solid var(--jk-line); border-radius: var(--jk-radius); }
.jk-check-col { width: 30px; }
.jk-link-title { display: inline-flex; align-items: center; gap: 4px; }
.jk-favicon { vertical-align: middle; }
.jk-row-actions { display: block; margin-top: 4px; font-size: 12px; color: var(--jk-grey); visibility: hidden; }
tr:hover .jk-row-actions { visibility: visible; }
.jk-visit { margin-left: 4px; }
.jk-meta { color: var(--jk-grey); font-size: 12px; }
.jk-slugbox { display: inline-flex; align-items: center; gap: 4px; }
.jk-slugbox input { background: #f6f7f7; }
.jk-copy-btn { background: none; border: none; cursor: pointer; font-size: 14px; color: var(--jk-grey); padding: 2px; }
.jk-pagesize { margin: 10px 0; }

/* Toggle switch (list status + form options) */
.jk-switch {
    display: inline-block; width: 40px; height: 20px; border-radius: 999px;
    background: #c3c4c7; position: relative; border: none; cursor: pointer; padding: 0;
    vertical-align: middle;
}
.jk-switch > span {
    position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
    border-radius: 50%; background: #fff; transition: left .15s ease;
}
.jk-switch.jk-on, .jk-switch-wrap input:checked + .jk-switch { background: var(--jk-grad); }
.jk-switch.jk-on > span, .jk-switch-wrap input:checked + .jk-switch > span { left: 22px; }
.jk-switch-wrap { display: inline-flex; cursor: pointer; }
.jk-switch-wrap input { display: none; }

/* ---------- Pagination ---------- */
.jk-pagination { display: flex; gap: 5px; align-items: center; margin: 12px 0; flex-wrap: wrap; }
.jk-page-btn {
    display: inline-block; background: #fff; border: 1px solid #c3c4c7; color: var(--jk-ink);
    border-radius: 4px; padding: 4px 10px; font-size: 13px;
}
.jk-page-btn:hover { text-decoration: none; border-color: var(--jk-blue); }
.jk-page-current { background: var(--jk-grad); color: #fff; border-color: transparent; font-weight: 700; }
.jk-page-gap { color: var(--jk-grey); }
.jk-page-info { color: var(--jk-grey); font-size: 12px; margin-left: 8px; }

/* ---------- Forms ---------- */
.jk-breadcrumb { font-size: 13px; color: var(--jk-grey); margin-bottom: 6px; }
.jk-form-card { max-width: 860px; }
.jk-form-row { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; flex-wrap: wrap; }
.jk-form-label { flex: 0 0 170px; font-weight: 600; color: #3c434a; padding-top: 6px; }
.jk-input { flex: 1; min-width: 220px; }
.jk-select { flex: 0 1 260px; }
.jk-help { display: block; color: var(--jk-grey); font-size: 12px; flex-basis: 100%; margin-left: 184px; }
.jk-warn { color: #b32d2e; }
.jk-slug-field { display: inline-flex; flex: 1; min-width: 260px; }
.jk-slug-prefix {
    background: #f0f0f1; border: 1px solid #c3c4c7; border-right: none;
    border-radius: 4px 0 0 4px; padding: 6px 8px; color: var(--jk-grey); font-size: 13px;
    display: inline-flex; align-items: center;
}
.jk-slug-input { border-radius: 0 4px 4px 0; flex: 1; }
.jk-group-picker { display: flex; flex-direction: column; gap: 6px; padding-top: 5px; }
.jk-check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; margin: 4px 14px 4px 0; cursor: pointer; }
.jk-radio { display: block; font-size: 13px; margin: 4px 0; cursor: pointer; }
.jk-fieldset { border: 1px solid var(--jk-line); border-radius: var(--jk-radius); padding: 14px 16px 6px; margin: 18px 0; }
.jk-fieldset legend { font-weight: 700; padding: 0 6px; }
.jk-form-actions { margin-top: 16px; display: flex; gap: 10px; align-items: center; }
.jk-form { display: block; }
.jk-field { display: block; margin-bottom: 14px; }
.jk-field > span { display: block; font-weight: 600; margin-bottom: 5px; }
.jk-field input, .jk-field textarea { width: 100%; }

/* Password visibility toggle (button added by app.js) */
.jk-pass-wrap { position: relative; display: inline-flex; align-items: center; }
.jk-pass-wrap > input.jk-pass { padding-right: 38px; }
.jk-field .jk-pass-wrap { display: flex; width: 100%; }
.jk-form-row .jk-pass-wrap { flex: 1; min-width: 220px; }
.jk-form-row .jk-pass-wrap > input.jk-pass { flex: 1; width: 100%; min-width: 0; }
.jk-worker-actions .jk-pass-wrap { width: 210px; max-width: 100%; vertical-align: middle; }
.jk-worker-actions .jk-pass-wrap > input.jk-pass { width: 100%; min-width: 0; }
.jk-pass-toggle {
    position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
    width: 30px; height: 30px; padding: 5px; display: inline-flex;
    align-items: center; justify-content: center; border: 0; border-radius: 4px;
    background: transparent; color: var(--jk-grey); cursor: pointer; z-index: 1;
}
.jk-pass-toggle:hover { color: var(--jk-blue); background: #f0f6fb; }
.jk-pass-toggle:focus-visible { outline: 2px solid var(--jk-blue); outline-offset: 1px; }
.jk-pass-toggle svg { display: block; width: 20px; height: 20px; }

/* ---------- Tabs / settings / tools ---------- */
.jk-tabs { display: flex; gap: 2px; margin-bottom: -1px; }
.jk-tab {
    background: #e9eaeb; border: 1px solid var(--jk-line); border-bottom: none;
    border-radius: 6px 6px 0 0; padding: 8px 16px; color: var(--jk-ink); font-size: 13px;
}
.jk-tab:hover { text-decoration: none; }
.jk-tab-active { background: #fff; font-weight: 700; }
.jk-settings-card { border-radius: 0 var(--jk-radius) var(--jk-radius) var(--jk-radius); }
.jk-settings-banner {
    background: var(--jk-grad); color: #fff; font-weight: 700;
    margin: -16px -18px 16px; padding: 10px 18px; border-radius: var(--jk-radius) var(--jk-radius) 0 0;
}
.jk-digest-status { background: #e8f5e9; border-radius: var(--jk-radius); padding: 10px 14px; margin: 12px 0; font-size: 13px; }
.jk-mail-preview { background: #f6f7f7; border: 1px solid var(--jk-line); border-radius: var(--jk-radius); padding: 12px; white-space: pre-wrap; font-size: 12px; }
.jk-tool-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.jk-trim-list > div { margin-bottom: 10px; }
.jk-info-icon { color: var(--jk-grey); cursor: help; }

/* ---------- Statistics ---------- */
.jk-stat-title { display: flex; align-items: center; gap: 8px; color: var(--jk-blue); }
.jk-shortbox { display: flex; gap: 8px; align-items: center; max-width: 560px; }
.jk-shortbox .jk-input { flex: 1; }
.jk-qr { margin-top: 14px; }
.jk-qr p { color: var(--jk-grey); font-size: 12px; margin: 0 0 6px; }
.jk-segmented { display: inline-flex; background: #e9eaeb; border-radius: 999px; padding: 3px; }
.jk-seg { padding: 4px 14px; border-radius: 999px; color: var(--jk-grey); font-size: 13px; }
.jk-seg:hover { text-decoration: none; }
.jk-seg-active { background: #fff; color: var(--jk-ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.jk-refresh-btn {
    display: inline-flex; width: 30px; height: 30px; border: 1px solid #c3c4c7; border-radius: 50%;
    background: #fff; color: var(--jk-grey); align-items: center; justify-content: center; font-size: 15px;
}
.jk-refresh-btn:hover { text-decoration: none; }

/* ---------- Public pages ---------- */
.jk-public { background: var(--jk-bg); }
.jk-public-wrap { max-width: 520px; margin: 48px auto; padding: 0 16px; }
.jk-public-brand { text-align: center; margin-bottom: 18px; color: var(--jk-ink); }
.jk-public-brand .jk-logo-sub { color: var(--jk-grey); margin-left: 0; text-align: center; }
.jk-public-card {
    background: #fff; border: 1px solid var(--jk-line); border-radius: 8px; padding: 26px 28px;
}
.jk-public-card h1 { font-size: 21px; }
.jk-public-center { text-align: center; }
.jk-public-foot { text-align: center; color: var(--jk-grey); font-size: 12px; margin-top: 16px; }

/* ---------- Dynamic redirection + REST API ---------- */
.jk-dyn-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.jk-dyn-row .jk-dyn-type { flex: 0 0 130px; }
.jk-dyn-row .jk-dyn-value { flex: 1 1 160px; }
.jk-dyn-row .jk-dyn-url { flex: 2 1 220px; }
.jk-inline-form { display: inline; margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .jk-cards, .jk-dim-grid { grid-template-columns: repeat(2, 1fr); }
    .jk-sidebar { width: 150px; flex-basis: 150px; }
    .jk-form-label { flex-basis: 100%; }
    .jk-help { margin-left: 0; }
}
@media (max-width: 560px) {
    .jk-cards, .jk-dim-grid { grid-template-columns: 1fr; }
    .jk-shell { flex-direction: column; }
    .jk-sidebar { width: 100%; flex-basis: auto; height: auto; position: static; }
}
