:root {
    --bg: #f0f2f5;
    --surface: #ffffff;
    --surface-raised: #f8f9fa;
    --text: #1c1e21;
    --text-secondary: #65676b;
    --text-muted: #a0a0a0;
    --border: #e4e6eb;
    --border-faint: #f0f0f0;
    --primary: #1877f2;
    --primary-hover: #166fe5;
    --primary-ghost: rgba(24, 119, 242, 0.08);
    --green: #31a24c;
    --green-bg: rgba(49, 162, 76, 0.1);
    --amber: #f0ad4e;
    --amber-bg: rgba(240, 173, 78, 0.1);
    --red: #dc3545;
    --red-bg: rgba(220, 53, 69, 0.1);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-theme {
    --bg: #0d1117;
    --surface: #161b22;
    --surface-raised: #1c2333;
    --text: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --border: #30363d;
    --border-faint: #21262d;
    --primary: #4a9eff;
    --primary-hover: #3a8eef;
    --primary-ghost: rgba(74, 158, 255, 0.1);
    --green: #3fb950;
    --green-bg: rgba(63, 185, 80, 0.12);
    --amber: #d29922;
    --amber-bg: rgba(210, 153, 34, 0.12);
    --red: #f85149;
    --red-bg: rgba(248, 81, 73, 0.12);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    transition: background var(--transition), color var(--transition);
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 32px 20px 60px;
}

/* ---------- header ---------- */
header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 32px;
    animation: fadeSlideDown 0.4s ease-out;
}

h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.3px;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.theme-toggle {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}

.theme-toggle:hover {
    background: var(--surface-raised);
    color: var(--text);
    box-shadow: var(--shadow-md);
    transform: rotate(15deg);
}

/* ---------- tabs ---------- */
.tabs {
    display: flex;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    animation: fadeSlideDown 0.4s ease-out 0.1s both;
}

.tab {
    flex: 1;
    padding: 11px 16px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.tab.active {
    background: var(--primary-ghost);
    color: var(--primary);
}

.tab:hover:not(.active) {
    color: var(--text);
    background: var(--surface-raised);
}

.tab-content {
    animation: fadeIn 0.25s ease-out;
}

.hidden { display: none !important; }

/* ---------- search ---------- */
.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    animation: fadeSlideDown 0.4s ease-out 0.15s both;
}

.search-box input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-family: var(--font);
    outline: none;
    background: var(--surface);
    color: var(--text);
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-ghost);
}

.search-box input::placeholder { color: var(--text-muted); }

.search-box button {
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--primary), #2563eb);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
}

.search-box button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.search-box button:active:not(:disabled) {
    transform: translateY(0);
}

.search-box button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ---------- progress ---------- */
.progress-container {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    animation: fadeIn 0.2s ease-out;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--text-secondary);
}

.progress-bar-track {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #a855f7);
    border-radius: 99px;
    transition: width 0.3s ease-out;
    width: 0%;
}

.progress-text {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 8px;
    text-align: right;
}

/* ---------- loader (skeleton) ---------- */
.skeleton {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    animation: fadeIn 0.2s ease-out;
}

.skeleton-line {
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--border) 25%, var(--border-faint) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    margin-bottom: 12px;
}

.skeleton-line:last-child { margin-bottom: 0; }

.skeleton-line.w50 { width: 50%; }
.skeleton-line.w60 { width: 60%; }
.skeleton-line.w70 { width: 70%; }
.skeleton-line.w40 { width: 40%; }
.skeleton-line.h2 { height: 20px; }

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---------- result card ---------- */
.result-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    animation: cardEnter 0.35s ease-out;
}

@keyframes cardEnter {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.card-header {
    padding: 16px 20px;
    font-size: 16px;
    font-weight: 700;
    background: var(--primary-ghost);
    border-bottom: 1px solid var(--border);
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header .badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 99px;
    margin-left: auto;
}

.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }

.card-body {
    padding: 16px 20px;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ---------- model card ---------- */
.model-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    border-left: 4px solid var(--border);
    transition: all var(--transition);
    background: var(--surface);
}

.model-card:hover {
    box-shadow: var(--shadow-sm);
}

.model-card.found-kkt { border-left-color: var(--green); }
.model-card.found-fn { border-left-color: var(--primary); }

.model-card .field {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 14px;
    align-items: baseline;
}

.model-card .field:last-child { margin-bottom: 0; }

.field-label {
    color: var(--text-secondary);
    min-width: 130px;
    flex-shrink: 0;
    font-size: 13px;
}

.field-value {
    color: var(--text);
    font-weight: 500;
}

/* ---------- status chips ---------- */
.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
}

.status-chip::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-chip.green { background: var(--green-bg); color: var(--green); }
.status-chip.green::before { background: var(--green); }

.status-chip.amber { background: var(--amber-bg); color: var(--amber); }
.status-chip.amber::before { background: var(--amber); }

.status-chip.red { background: var(--red-bg); color: var(--red); }
.status-chip.red::before { background: var(--red); }

.status-chip.neutral { background: var(--surface-raised); color: var(--text-secondary); }
.status-chip.neutral::before { background: var(--text-muted); }

/* ---------- warning ---------- */
.warning-box {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--amber);
    background: var(--amber-bg);
    color: var(--amber);
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.4;
}

.warning-box .icon { flex-shrink: 0; }

/* ---------- excisable ---------- */
.excisable-box {
    margin-top: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--amber);
    border-radius: var(--radius-md);
    background: var(--surface-raised);
}

.excisable-header {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--amber);
    margin-bottom: 8px;
}

.excisable-box .field {
    margin-bottom: 6px;
}

.excisable-box .field:last-child {
    margin-bottom: 0;
}

/* ---------- not-found ---------- */
.not-found, .api-error {
    text-align: center;
    padding: 40px 20px;
    animation: fadeIn 0.3s ease-out;
}

.not-found {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.not-found strong { color: var(--text); }

.not-found .icon-big {
    font-size: 40px;
    margin-bottom: 12px;
    display: block;
    opacity: 0.6;
}

.not-found-text {
    color: var(--text-secondary);
    font-size: 15px;
    margin-top: 8px;
}

.api-error {
    background: var(--red-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--red);
    color: var(--red);
    font-weight: 600;
}

/* ---------- footer ---------- */
footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
    animation: fadeIn 0.5s ease-out 0.3s both;
}

footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition);
}

footer a:hover { text-decoration: underline; }

footer .sep { margin: 0 8px; color: var(--border); }

/* ---------- animations ---------- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeSlideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- responsive ---------- */
@media (max-width: 600px) {
    .container { padding: 20px 16px 40px; }
    h1 { font-size: 22px; }
    .search-box { flex-direction: column; }
    .search-box button { width: 100%; }
    .card-header { flex-wrap: wrap; }
    .model-card .field { flex-direction: column; gap: 2px; }
    .field-label { min-width: auto; }
}

/* ---------- scrollbar ---------- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
