/* 短链接系统后台样式 */
* { box-sizing: border-box; }

:root {
    --brand: #3370ff;
    --brand-dark: #245bdb;
    --text: #1f2329;
    --muted: #8a9099;
    --line: #e5e7eb;
    --bg: #f5f6f8;
    --danger: #e34d59;
    --green: #00a870;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 190px;
    flex: 0 0 190px;
    background: #fff;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.logo {
    padding: 20px 18px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: .5px;
    border-bottom: 1px solid var(--line);
}

.sidebar nav { padding: 10px 0; flex: 1; }

.sidebar nav a {
    display: block;
    padding: 10px 18px;
    color: #4e5969;
    font-size: 14px;
}

.sidebar nav a:hover { background: #f2f3f5; text-decoration: none; }
.sidebar nav a.on { color: var(--brand); background: #eef3ff; font-weight: 500; }

.side-foot {
    padding: 14px 18px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--muted);
}

.main { flex: 1; padding: 24px 28px 48px; min-width: 0; }

/* ---------- 页头 ---------- */
.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.page-head h2 { margin: 0 0 6px; font-size: 20px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.page-head p { margin: 0; font-size: 13px; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}

.btn:hover { border-color: #c9cdd4; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.ghost { background: #fff; color: #4e5969; }
.btn.block { width: 100%; justify-content: center; }

/* ---------- 筛选 ---------- */
.filter {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.filter input[type=text] {
    width: 300px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    outline: none;
}

.filter select {
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
}

.filter input:focus, .filter select:focus { border-color: var(--brand); }

/* ---------- 卡片 / 表格 ---------- */
.card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
    overflow: hidden;
}

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

.table th {
    text-align: left;
    font-weight: 500;
    color: var(--muted);
    font-size: 13px;
    padding: 12px;
    background: #fafbfc;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.table td {
    padding: 12px;
    border-bottom: 1px solid #f2f3f5;
    vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fafbfc; }
.table .empty { text-align: center; color: var(--muted); padding: 40px 12px; }

.url {
    max-width: 420px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.url a { color: #4e5969; }
.short { font-family: ui-monospace, Consolas, monospace; font-weight: 600; }

.mini {
    margin-left: 6px;
    padding: 1px 6px;
    font-size: 12px;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
}

.mini:hover { color: var(--brand); border-color: var(--brand); }

.ops { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ops form { display: inline; margin: 0; }
.link {
    padding: 0;
    border: none;
    background: none;
    font-size: 14px;
    cursor: pointer;
}
.link.danger { color: var(--danger); }

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 18px;
}

.tag.green { color: var(--green); background: #e8f8f2; }
.tag.gray { color: var(--muted); background: #f2f3f5; }

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 18px;
}

/* ---------- 提示 ---------- */
.alert {
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 13px;
    line-height: 1.7;
}

.alert.success { background: #e8f8f2; color: #00764b; }
.alert.error { background: #fdecee; color: #c4303c; }

/* ---------- 表单 ---------- */
.form { padding: 22px 24px; }

.field { display: block; margin-bottom: 18px; }
.field > span { display: block; margin-bottom: 6px; font-size: 13px; color: #4e5969; }
.field em { color: var(--danger); font-style: normal; }
.field small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }

.field input[type=text],
.field input[type=password],
.field input[type=datetime-local],
.field select,
.field textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    outline: none;
    resize: vertical;
}

.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); }

.input-group { display: flex; align-items: stretch; }

.input-group .prefix {
    display: inline-flex;
    align-items: center;
    padding: 0 10px;
    background: #f7f8fa;
    border: 1px solid var(--line);
    border-right: none;
    border-radius: 6px 0 0 6px;
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}

.input-group input { border-radius: 0 6px 6px 0; }

.row2 { display: flex; gap: 18px; }
.row2 .field { flex: 1; }

.form-actions { display: flex; gap: 12px; padding-top: 4px; }

/* ---------- 统计卡片 ---------- */
.stats { display: flex; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }

.stat {
    flex: 1;
    min-width: 150px;
    background: #fff;
    border-radius: 10px;
    padding: 16px 18px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
}

.stat span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.stat strong { font-size: 20px; font-weight: 600; }

.ua { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 登录页 ---------- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(160deg, #eef3ff 0%, #f5f6f8 60%);
}

.login-box {
    width: 340px;
    padding: 30px 28px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(31, 35, 41, .10);
}

.login-box h1 { margin: 0 0 6px; font-size: 20px; }
.login-box .sub { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.login-box label { display: block; margin-bottom: 14px; font-size: 13px; color: #4e5969; }

.login-box input {
    width: 100%;
    margin-top: 6px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
}

.login-box input:focus { border-color: var(--brand); }
.login-box .btn { margin-top: 6px; height: 38px; }

@media (max-width: 900px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; flex: none; height: auto; position: static; flex-direction: row; align-items: center; }
    .logo { border-bottom: none; padding: 14px; }
    .sidebar nav { display: flex; flex-wrap: wrap; padding: 0; }
    .sidebar nav a { padding: 14px 12px; }
    .side-foot { border-top: none; gap: 10px; }
    .main { padding: 16px; }
    .row2 { flex-direction: column; gap: 0; }
    .url, .ua { max-width: 220px; }
}

