:root {
    --bg: #f4f7fb;
    --card: #ffffff;
    --text: #253046;
    --muted: #7d8798;
    --line: #e5e9f1;
    --primary: #2f6fed;
    --primary-hover: #275ecc;
    --danger: #c83737;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(180deg, #f6f9ff 0%, var(--bg) 100%);
    color: var(--text);
}

.page {
    max-width: 1320px;
    margin: 0 auto;
    padding: 28px 16px 44px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

h1 {
    margin: 0;
    font-size: 28px;
}

h2, h3 {
    margin-top: 0;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 10px 24px rgba(24, 36, 58, 0.06);
    margin-bottom: 16px;
}

.login-card {
    max-width: 420px;
    margin: 80px auto 0;
}

.login-card .btn {
    margin-top: 20px;
}

label {
    display: block;
    font-weight: 600;
    margin: 10px 0 6px;
}

input, select {
    width: 100%;
    border: 1px solid #ccd5e3;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    background: #fff;
}

input:focus, select:focus {
    border-color: var(--primary);
    outline: 2px solid rgba(47, 111, 237, 0.15);
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.checkbox input {
    width: auto;
}

.btn {
    border: none;
    border-radius: 10px;
    padding: 10px 13px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
    transition: 0.18s ease;
}

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

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

.btn-light {
    background: #edf2ff;
    color: var(--text);
}

.btn-light:hover {
    background: #e0e9ff;
}

.btn-ghost {
    background: #f6f7fb;
    color: #566176;
}

.btn-ghost:hover {
    background: #eceff7;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #a72f2f;
}

.btn-small {
    padding: 7px 10px;
    font-size: 12px;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 16px;
    flex-wrap: wrap;
}

.filter-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 220px auto;
    gap: 12px;
    align-items: end;
    width: 100%;
    max-width: 840px;
}

.filter-buttons {
    display: flex;
    gap: 8px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    border-bottom: 1px solid var(--line);
    padding: 12px 8px;
    text-align: left;
    vertical-align: middle;
    font-size: 14px;
}

.table-wrap tbody td {
    height: 100%;
}

th {
    color: #445169;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

td a {
    color: #2456bb;
}

.target-url {
    max-width: 320px;
    word-break: break-all;
}

.actions {
    vertical-align: middle;
}

.actions-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    min-height: 100%;
}

.muted {
    color: var(--muted);
    text-align: center;
}

.alert {
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 14px;
    font-weight: 600;
}

.alert.success {
    background: #eaf7ee;
    color: #1e7a3b;
}

.alert.error {
    background: #ffeceb;
    color: #ab2f25;
}

.inline-form {
    display: inline;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(30, 40, 56, 0.45);
    display: grid;
    place-items: center;
    z-index: 1200;
    padding: 12px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    width: 100%;
    max-width: 540px;
    background: #fff;
    border-radius: 14px;
    padding: 18px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.close-modal {
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #5c6678;
}

.modal-actions {
    margin-top: 16px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

@media (max-width: 960px) {
    .filter-form {
        grid-template-columns: 1fr;
    }
}
