:root {
  --brand: #4F46E5; --brand-2: #06B6D4; --ink: #0F172A; --muted: #64748B; --line: #E2E8F0;
  --bg: #F8FAFC; --card: #fff; --ok: #059669; --ok-bg: #ECFDF5; --warn: #B45309; --warn-bg: #FFFBEB;
  --bad: #DC2626; --bad-bg: #FEF2F2; --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); overflow-x: hidden; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }
p { margin: 0 0 10px; }
small, .muted { color: var(--muted); }
img, svg { max-width: 100%; }

.top { position: sticky; top: 0; z-index: 10; background: var(--ink); color: #fff; }
.top-inner { max-width: 1200px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 16px; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: #fff; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.logo { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); display: grid; place-items: center; }
.nav { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: #CBD5E1; padding: 8px 12px; border-radius: 9px; white-space: nowrap; font-size: 14px; }
.nav a:hover, .nav a.on { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.pill { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 99px; background: var(--brand-2); color: #04252d; font-size: 12px; font-weight: 700; text-align: center; margin-left: 4px; }
.logout button { background: none; border: 0; color: #94A3B8; cursor: pointer; font: inherit; font-size: 14px; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 24px 16px 64px; }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 20px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.stat .n { font-size: 28px; font-weight: 800; color: var(--brand); line-height: 1.1; }
.stat .l { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; font-weight: 500; word-break: break-word; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border: 1px solid #A7F3D0; }
.flash.bad { background: var(--bad-bg); color: var(--bad); border: 1px solid #FECACA; }

.list { display: flex; flex-direction: column; }
.item { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item .t { font-weight: 600; color: var(--ink); word-break: break-word; }
.item .meta { font-size: 13px; color: var(--muted); margin-top: 2px; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; background: #EEF2FF; color: #3730A3; white-space: nowrap; }
.tag.high, .tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.medium, .tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.low, .tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.gray { background: #F1F5F9; color: #475569; }

.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 16px; }
.tabs a { padding: 7px 12px; border-radius: 99px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 14px; white-space: nowrap; }
.tabs a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tabs a:hover { text-decoration: none; }

label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
label .hint { font-weight: 400; color: var(--muted); }
input[type=text], input[type=url], input[type=password], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #CBD5E1; border-radius: 10px; font: inherit; font-size: 16px; background: #fff; color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
textarea.tall { min-height: 220px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #C7D2FE; border-color: var(--brand); }
.row2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 14px; }
.count { float: right; font-weight: 400; color: var(--muted); }
.count.over { color: var(--bad); font-weight: 700; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; min-height: 42px; }
.btn:hover { text-decoration: none; border-color: #94A3B8; }
.btn.primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border: 0; }
.btn.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.danger { color: var(--bad); border-color: #FECACA; }
.btn.sm { padding: 6px 10px; min-height: 34px; font-size: 13px; }
.btn[disabled] { opacity: .6; cursor: wait; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sticky-actions { position: sticky; bottom: 0; background: rgba(248,250,252,.96); backdrop-filter: blur(6px); padding: 12px 0; border-top: 1px solid var(--line); margin-top: 18px; z-index: 5; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.side { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 16px; }
.excerpt { white-space: pre-wrap; font-size: 13px; max-height: 360px; overflow: auto; background: #F8FAFC; border: 1px solid var(--line); border-radius: 10px; padding: 10px; word-break: break-word; }
.copybox { position: relative; }
.copybox textarea { padding-right: 70px; }
.copybox .btn { position: absolute; right: 6px; top: 6px; }
.warnbox { background: var(--warn-bg); border: 1px solid #FDE68A; color: #78350F; border-radius: 12px; padding: 12px 14px; font-size: 14px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-top: 0; }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.src-form { display: grid; grid-template-columns: minmax(0, 1fr) 110px auto auto; gap: 8px; align-items: center; }
.src-form input[type=url] { font-size: 14px; padding: 8px 10px; }
.src-form select { font-size: 14px; padding: 8px; }
.err-line { font-size: 12px; color: var(--bad); margin-top: 4px; word-break: break-word; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--ink); }
.login .card { width: 100%; max-width: 380px; padding: 28px; }

@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .side { position: static; }
}
@media (max-width: 640px) {
  .wrap { padding: 16px 16px 48px; }
  h1 { font-size: 20px; }
  .top-inner { gap: 10px; }
  .brand span { display: none; }
  .item { flex-direction: column; }
  .src-form { grid-template-columns: 1fr 1fr; }
  .src-form input[type=url] { grid-column: 1 / -1; }
  .sticky-actions .btn { flex: 1 1 calc(50% - 8px); }
}
