:root {
    --green: #0a6e3b;
    --green-light: #d5ecdf;
    --text: #111;
    --muted: #6b7280;
    --bg: #f6f7f9;
    --card: #ffffff;
    --border: #e5e7eb;
    --link: #0a6e3b;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
    font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 32px 24px 80px; }

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

h1 { font-size: 26px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 14px; color: var(--text); }
.subtitle { color: var(--muted); font-size: 14px; }
.muted { color: var(--muted); }

.topbar {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 24px; margin-bottom: 20px; flex-wrap: wrap;
}
.stats-summary { display: flex; gap: 12px; }
.stat-card {
    background: var(--card); border: 1px solid var(--border); border-radius: 10px;
    padding: 12px 18px; min-width: 110px; text-align: right;
}
.stat-value { font-size: 22px; font-weight: 700; color: var(--green); }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.domain-tabs, .period-tabs {
    display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap;
}
.domain-tabs a, .period-tabs a {
    padding: 6px 12px; background: #fff; border: 1px solid var(--border);
    border-radius: 999px; color: var(--text); font-size: 13px;
}
.domain-tabs a:hover, .period-tabs a:hover { text-decoration: none; background: #f0f1f3; }
.domain-tabs a.active, .period-tabs a.active {
    background: var(--green); color: #fff; border-color: var(--green);
}

.filter-bar {
    display: flex; gap: 8px; align-items: center; margin: 0 0 16px;
}
.filter-bar input[type=search] {
    flex: 1; max-width: 480px; padding: 8px 12px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 14px; background: #fff;
}
.filter-bar input[type=search]:focus { outline: 2px solid var(--green-light); border-color: var(--green); }
.filter-bar button {
    padding: 8px 16px; background: var(--green); color: #fff;
    border: 0; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.filter-bar .clear {
    width: 28px; height: 28px; line-height: 26px; text-align: center;
    background: #e5e7eb; border-radius: 999px; color: #111; font-weight: 700;
}

.error {
    background: #fef2f2; color: #991b1b; border: 1px solid #fecaca;
    padding: 10px 14px; border-radius: 8px; margin-bottom: 16px;
}

.links-table {
    width: 100%; border-collapse: collapse; background: var(--card);
    border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
}
.links-table th, .links-table td {
    text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top;
}
.links-table tr:last-child td { border-bottom: 0; }
.links-table thead { background: #fafafa; }
.links-table th { font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; font-weight: 600; }
.links-table th a { color: inherit; }
.links-table th.num, .links-table td.num { text-align: right; white-space: nowrap; }
.links-table td.actions { text-align: right; white-space: nowrap; }
.links-table td.clicks { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--green); }
.links-table td.truncate {
    max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.links-table td.empty { text-align: center; color: var(--muted); padding: 30px; }

.shortlink { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.shortlink strong { color: var(--green); }
.meta { color: var(--muted); font-size: 12px; margin-top: 2px; }

.btn {
    display: inline-block; padding: 6px 12px; background: #fff;
    border: 1px solid var(--border); border-radius: 6px; font-size: 13px;
}
.btn:hover { background: #f0f1f3; text-decoration: none; }

.breadcrumb { margin-bottom: 8px; font-size: 13px; }
.truncate-inline {
    display: inline-block; max-width: 60ch; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom;
}

.card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: 10px; padding: 18px 20px; margin-bottom: 16px;
}

.grid-2 {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }

.breakdown { list-style: none; margin: 0; padding: 0; }
.breakdown li {
    display: grid; grid-template-columns: 1fr auto;
    align-items: center; gap: 12px; padding: 6px 0; position: relative;
    border-bottom: 1px solid #f3f4f6;
}
.breakdown li:last-child { border-bottom: 0; }
.breakdown .bar {
    position: absolute; left: 0; top: 0; bottom: 0;
    background: var(--green-light); z-index: 0; border-radius: 4px;
}
.breakdown .lbl { position: relative; z-index: 1; padding-left: 8px; }
.breakdown .cnt { position: relative; z-index: 1; font-variant-numeric: tabular-nums; color: var(--muted); }

.site-footer {
    margin-top: 40px; text-align: center; color: var(--muted); font-size: 12px;
}
