@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;900&display=swap');

/* ── Brand tokens ───────────────────────────────────────── */
:root {
    --canvas-white: #FFFFFF;
    --canvas-gray:  #EEEEF0;
    --primary:      #1F2838;
    --secondary:    #97E2FF;
    --accent:       #3C4B66;
    --border:       #EEEEF0;
    --danger:       #b3261e;

    --radius-card:   24px;
    --radius-action: 10px;
    --pad-card:      40px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--canvas-gray);
    color: var(--primary);
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 25px;
    text-transform: capitalize;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    text-transform: capitalize;
    line-height: normal;
    color: var(--primary);
}
h1 { font-size: 61px; font-weight: 900; }
h2 { font-size: 48px; font-weight: 900; }
h3 { font-size: 39px; font-weight: 900; }
h4 { font-size: 31px; font-weight: 700; }
h5 { font-size: 25px; font-weight: 600; }
h6 { font-size: 18px; font-weight: 500; }

p { margin: 0; }

/* Preserve original casing for URLs, codes, IPs, anything technical */
.raw, .raw *,
input, select, textarea {
    text-transform: none;
}

/* ── Top bar ────────────────────────────────────────────── */
.bar {
    background: var(--canvas-white);
    border-bottom: 1px solid var(--border);
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
}
.brand-mark {
    width: 36px; height: 36px;
    background: var(--primary);
    color: var(--secondary);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', sans-serif;
    font-weight: 900;
    font-size: 18px;
    text-transform: none;
    flex-shrink: 0;
}
.brand .back {
    font-size: 22px;
    color: var(--accent);
    text-decoration: none;
    margin-right: 4px;
    font-weight: 500;
}
.brand .back:hover { color: var(--primary); }

.bar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}
.bar-link {
    font-size: 14px;
    color: var(--accent);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: var(--radius-action);
}
.bar-link:hover { color: var(--primary); background: var(--canvas-gray); }

/* ── Layout ─────────────────────────────────────────────── */
main {
    max-width: 1080px;
    margin: 0 auto;
    padding: 56px 24px 80px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.card {
    background: var(--canvas-white);
    border-radius: var(--radius-card);
    padding: var(--pad-card);
}
.card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 28px;
}
.card-head h5 { margin: 0; }

/* Sky-blue reverse card (for the stat hero) */
.card-secondary {
    background: var(--secondary);
    color: var(--primary);
    position: relative;
    overflow: hidden;
}

/* ── Forms ──────────────────────────────────────────────── */
.form-row {
    display: grid;
    grid-template-columns: 2fr 1fr auto;
    gap: 20px;
    align-items: end;
}
@media (max-width: 760px) {
    .form-row { grid-template-columns: 1fr; }
}

label {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--accent);
}
label .opt {
    font-weight: 400;
    text-transform: lowercase;
    color: var(--accent);
    opacity: .7;
}

input[type=url], input[type=text], input[type=password] {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 400;
    background: var(--canvas-white);
    color: var(--primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-action);
    padding: 14px 16px;
    width: 100%;
    transition: border-color .15s ease;
}
input::placeholder { color: var(--accent); opacity: .55; }
input:focus { outline: none; border-color: var(--primary); }

/* ── Buttons ────────────────────────────────────────────── */
button, .btn {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 500;
    text-transform: capitalize;
    cursor: pointer;
    border: 0;
    border-radius: var(--radius-action);
    padding: 14px 28px;
    background: var(--primary);
    color: var(--secondary);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    line-height: 1;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
button:hover { background: #2a3447; }
button .arrow {
    display: inline-block;
    font-size: 16px;
    transition: transform .15s ease;
    text-transform: none;
}
button:hover .arrow { transform: translateX(3px); }

button.reverse { background: var(--secondary); color: var(--primary); }
button.reverse:hover { background: #b8ebff; }

button.ghost {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 13px 27px;
}
button.ghost:hover { background: var(--primary); color: var(--secondary); }

button.ghost-sm {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--border);
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 8px;
}
button.ghost-sm:hover { color: var(--primary); border-color: var(--primary); }

button.danger {
    background: transparent;
    color: var(--accent);
    padding: 8px 14px;
    font-size: 13px;
    text-transform: lowercase;
}
button.danger:hover { background: transparent; color: var(--danger); }

/* ── Table ──────────────────────────────────────────────── */
.links {
    width: 100%;
    border-collapse: collapse;
}
.links th, .links td {
    text-align: left;
    padding: 18px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.links th:first-child, .links td:first-child { padding-left: 4px; }
.links th:last-child,  .links td:last-child  { padding-right: 4px; text-align: right; }
.links thead th {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: .06em;
    text-transform: uppercase;
    padding-top: 0;
    padding-bottom: 14px;
    border-bottom-color: var(--primary);
}
.links tbody tr:last-child td { border-bottom: 0; }
.links td.num, .links th.num { text-align: right; font-variant-numeric: tabular-nums; }

.short-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}
.short-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 2px solid var(--secondary);
    padding-bottom: 1px;
}
.short-link:hover { border-bottom-color: var(--primary); }

.click-pill {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 999px;
    background: var(--secondary);
    color: var(--primary);
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    text-transform: none;
    font-variant-numeric: tabular-nums;
    transition: background .15s ease;
}
.click-pill:hover { background: #b8ebff; }
.click-pill.zero { background: var(--canvas-gray); color: var(--accent); }

.dest {
    color: var(--accent);
    text-decoration: none;
    font-weight: 400;
}
.dest:hover { color: var(--primary); }

.trunc {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}

.muted { color: var(--accent); }
.small { font-size: 13px; line-height: 20px; }
.center { text-align: center; }

/* ── Flash messages ─────────────────────────────────────── */
.flash {
    padding: 16px 24px;
    border-radius: var(--radius-action);
    background: var(--canvas-white);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    font-weight: 500;
}
.flash.ok  { border-left-color: var(--primary); }
.flash.err { border-left-color: var(--danger); color: var(--danger); }

/* ── Empty state ────────────────────────────────────────── */
.empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--accent);
}
.empty h6 { color: var(--primary); margin-bottom: 8px; }

/* ── Login ──────────────────────────────────────────────── */
.center-page {
    min-height: 100vh;
    background: var(--canvas-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
}
.login-card {
    width: 100%;
    max-width: 460px;
    padding: 56px 48px;
    position: relative;
    z-index: 1;
}
.login-card .brand-mark { margin-bottom: 24px; }
.login-card h3 { margin-bottom: 8px; }
.login-card .lede { color: var(--accent); margin-bottom: 28px; }
.login-card form { display: flex; flex-direction: column; gap: 16px; }
.login-card button { justify-content: center; padding: 16px 28px; }

/* Floating decor (login only) */
.decor {
    position: absolute;
    font-family: 'Inter', sans-serif;
    font-weight: 900;
    color: var(--primary);
    text-transform: none;
    pointer-events: none;
    user-select: none;
    opacity: .12;
}
.decor.d1 { top: 14%; left: 10%; font-size: 64px; transform: rotate(-12deg); }
.decor.d2 { bottom: 18%; right: 12%; font-size: 84px; transform: rotate(15deg); }
.decor.d3 { top: 22%; right: 18%; font-size: 32px; color: var(--secondary); opacity: 1; transform: rotate(8deg); }
@keyframes float {
    0%,100% { transform: translateY(0)  rotate(var(--r, 0deg)); }
    50%     { transform: translateY(-8px) rotate(var(--r, 0deg)); }
}
.decor.d1 { --r: -12deg; animation: float 8s ease-in-out infinite; }
.decor.d2 { --r:  15deg; animation: float 7s ease-in-out infinite reverse; }

.err-msg { color: var(--danger); font-size: 13px; margin: 4px 0 0; text-transform: none; }

/* ── Stats hero ─────────────────────────────────────────── */
.hero-stat {
    padding: 56px 48px 48px;
}
.hero-stat .num {
    font-size: 96px;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 8px;
    letter-spacing: -.02em;
    text-transform: none;
}
.hero-stat .label {
    font-size: 18px;
    font-weight: 500;
    color: var(--primary);
    opacity: .65;
    margin-bottom: 40px;
}
.hero-stat .decor {
    color: var(--primary);
    opacity: .15;
    font-size: 56px;
    top: 32px;
    right: 40px;
    transform: rotate(15deg);
}

/* Chart */
.chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 140px;
}
.bar-wrap {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: flex-end;
}
.bar-fill {
    width: 100%;
    background: var(--primary);
    border-radius: 4px 4px 0 0;
    min-height: 2px;
    transition: opacity .15s ease;
}
.bar-wrap:hover .bar-fill { opacity: .65; }
.chart-axis {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--primary);
    opacity: .55;
}

/* Meta grid */
.meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 28px 40px;
}
@media (max-width: 600px) { .meta { grid-template-columns: 1fr; } }
.meta-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--accent);
    margin-bottom: 8px;
    font-weight: 600;
}
.meta-value {
    font-size: 17px;
    font-weight: 500;
    color: var(--primary);
}
.meta-value a { color: var(--primary); text-decoration: none; border-bottom: 2px solid var(--secondary); padding-bottom: 1px; }
.meta-value a:hover { border-bottom-color: var(--primary); }

/* ── Confirm modal (replaces native confirm() per JCWD UI rule) ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 20, 30, 0.72);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-box {
    background: var(--canvas-white);
    border-radius: var(--radius-card);
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--border);
    overflow: hidden;
}
.modal-head {
    background: var(--primary);
    padding: 20px 28px;
}
.modal-head h2 {
    font-size: 17px;
    font-weight: 900;
    color: var(--secondary);
    margin: 0;
}
.modal-body {
    padding: 24px 28px;
}
.modal-body p {
    color: var(--accent);
    line-height: 1.5;
    margin: 0;
    text-transform: none;
}
