﻿:root {
    --bg: #11141a;
    --panel: #171c24;
    --panel-alt: #1d232d;
    --row-active: #19222d;
    --row-inactive: #21191c;
    --border: #28303d;
    --border-light: #354052;
    --text: #e6ebf2;
    --text-dim: #8a96a8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --active-bar: #2ea8e6;
    --active-text: #5bc0f8;
    --inactive-bar: #d94848;
    --inactive-text: #f07171;
    --ok-bg: rgba(46, 168, 230, 0.14);
    --err-bg: rgba(217, 72, 72, 0.14);
    --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    padding: 20px 14px 56px;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 0.9375rem;
    line-height: 1.4;
}

.container {
    max-width: 1040px;
    margin: 0 auto;
}

/* Top Bar */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 14px;
}

.brand-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 4px;
    background: var(--panel-alt);
    border: 1px solid var(--border-light);
    font-family: var(--mono);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--active-text);
}

.topbar h1 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.subtitle {
    margin: 1px 0 0;
    font-size: 0.78125rem;
    color: var(--text-dim);
}

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

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 10px;
    border-radius: 4px;
    background: var(--panel-alt);
    border: 1px solid var(--border);
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* Panels (Lolvvv dark structured blocks) */
.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 14px;
    overflow: hidden;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--panel-alt);
    border-bottom: 1px solid var(--border);
}

    .panel-head h2 {
        margin: 0;
        font-size: 0.875rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--text);
    }

.panel-body {
    padding: 14px 16px;
}

.row-split {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

    .row-split h3 {
        width: 100%;
        margin: 0 0 8px;
        font-size: 0.75rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--text-dim);
    }

/* Inputs & Controls */
.row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: stretch;
}

input[type="text"],
input[type="url"],
input[type="password"],
input[type="datetime-local"],
input[type="file"] {
    min-height: 44px;
    padding: 9px 11px;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
}

input[type="file"] {
    padding: 8px 10px;
    font-size: 0.875rem;
}

input:focus {
    outline: none;
    border-color: var(--accent);
}

.grow {
    flex: 1 1 240px;
}

.input-sm {
    flex: 1 1 170px;
    max-width: 230px;
}

.input-alias {
    flex: 0 1 140px;
    min-width: 120px;
}

.input-date {
    flex: 0 1 205px;
    min-width: 185px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 4px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

    .btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

.btn-primary {
    background: var(--accent);
    color: #ffffff;
}

    .btn-primary:hover:not(:disabled) {
        background: var(--accent-hover);
    }

.btn-secondary {
    background: var(--panel-alt);
    color: var(--text);
    border-color: var(--border-light);
}

    .btn-secondary:hover:not(:disabled) {
        background: #252d3a;
    }

.btn-ghost {
    background: transparent;
    color: var(--text-dim);
    border-color: var(--border);
}

    .btn-ghost:hover:not(:disabled) {
        background: var(--panel-alt);
        color: var(--text);
    }

.btn-danger {
    background: transparent;
    color: var(--inactive-text);
    border-color: rgba(217, 72, 72, 0.45);
}

    .btn-danger:hover:not(:disabled) {
        background: var(--err-bg);
    }

.btn-sm {
    min-height: 36px;
    padding: 0 10px;
    font-size: 0.78125rem;
}

/* Messages */
.msg-ok,
.msg-err {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.84375rem;
}

.msg-ok {
    background: var(--ok-bg);
    color: var(--active-text);
    border: 1px solid rgba(46, 168, 230, 0.35);
}

    .msg-ok a {
        color: #ffffff;
        font-weight: 600;
    }

.msg-err {
    background: var(--err-bg);
    color: var(--inactive-text);
    border: 1px solid rgba(217, 72, 72, 0.35);
}

.key-text {
    font-family: var(--mono);
    font-size: 0.8125rem;
    color: var(--active-text);
    word-break: break-all;
}

/* Data Rows (Lolvvv left-border match row feel) */
.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 6px;
}

th {
    text-align: left;
    padding: 4px 10px;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
}

tbody tr.row-active {
    background: var(--row-active);
}

tbody tr.row-inactive {
    background: var(--row-inactive);
}

tbody td {
    padding: 10px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    font-size: 0.84375rem;
    vertical-align: middle;
}

    tbody td:first-child {
        border-left: 4px solid var(--border-light);
        border-top-left-radius: 4px;
        border-bottom-left-radius: 4px;
    }

tbody tr.row-active td:first-child {
    border-left-color: var(--active-bar);
}

tbody tr.row-inactive td:first-child {
    border-left-color: var(--inactive-bar);
}

tbody td:last-child {
    border-right: 1px solid var(--border);
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

.code-cell {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.short-link {
    font-family: var(--mono);
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--active-text);
    text-decoration: none;
}

    .short-link:hover {
        text-decoration: underline;
    }

.file-tag {
    display: inline-block;
    margin-right: 6px;
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--panel-alt);
    border: 1px solid var(--border-light);
    font-family: var(--mono);
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--active-text);
}

.target-cell {
    max-width: 340px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-dim);
    font-family: var(--mono);
    font-size: 0.78125rem;
}

.status-active {
    font-family: var(--mono);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--active-text);
}

.status-inactive {
    font-family: var(--mono);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--inactive-text);
}

.clicks-cell {
    font-family: var(--mono);
    font-weight: 700;
}

.actions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.empty-row {
    text-align: center;
    color: var(--text-dim);
    padding: 20px 10px;
    background: var(--panel-alt);
    border-radius: 4px;
}

pre {
    margin: 0;
    padding: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--mono);
    font-size: 0.8125rem;
    overflow-x: auto;
}

/* Modal & Toast */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 50;
}

.modal-box {
    width: 100%;
    max-width: 350px;
    margin-bottom: 0;
}

.modal-center {
    text-align: center;
}

.qr-img {
    display: block;
    width: 210px;
    height: 210px;
    margin: 0 auto 12px;
    padding: 8px;
    background: #ffffff;
    border-radius: 4px;
}

.qr-url {
    margin: 0;
    font-family: var(--mono);
    font-size: 0.78125rem;
    color: var(--text-dim);
    word-break: break-all;
}

.toast {
    position: fixed;
    bottom: 18px;
    right: 18px;
    z-index: 60;
    padding: 9px 14px;
    border-radius: 4px;
    background: var(--panel-alt);
    border: 1px solid var(--border-light);
    color: var(--text);
    font-size: 0.84375rem;
    font-weight: 600;
}

.hidden {
    display: none !important;
}

/* Mobile Card Rows (< 768px) */
@media (max-width: 767px) {
    body {
        padding: 12px 10px 56px;
    }

    .row > input,
    .row > button {
        width: 100%;
        max-width: none;
        flex: 1 1 100%;
    }

    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
    }

    thead {
        display: none;
    }

    tbody tr {
        border: 1px solid var(--border);
        border-radius: 4px;
        padding: 10px 12px;
        margin-bottom: 10px;
    }

        tbody tr.row-active {
            border-left: 4px solid var(--active-bar);
        }

        tbody tr.row-inactive {
            border-left: 4px solid var(--inactive-bar);
        }

    tbody td,
    tbody td:first-child,
    tbody td:last-child {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        padding: 6px 0;
        border: none;
        border-bottom: 1px solid var(--border);
        border-radius: 0;
    }

        tbody td::before {
            content: attr(data-label);
            font-size: 0.6875rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            color: var(--text-dim);
            flex-shrink: 0;
        }

        tbody td.target-cell {
            max-width: none;
            white-space: normal;
            word-break: break-all;
            text-align: right;
        }

        tbody td.actions-cell {
            justify-content: flex-end;
            padding-top: 8px;
        }

        tbody td:last-child {
            border-bottom: none;
            padding-bottom: 0;
        }

    .toast {
        left: 10px;
        right: 10px;
        bottom: 12px;
        text-align: center;
    }
}
