:root {
	--primary: #0f766e;
	--primary-dark: #115e59;
	--primary-soft: #ecfdf5;
	--ink: #12201e;
	--muted: #64748b;
	--line: #dbe5e3;
	--surface: #ffffff;
	--canvas: #f4f7f6;
	--danger: #be123c;
	--danger-soft: #fff1f2;
	--shadow: 0 16px 40px rgba(15, 74, 68, 0.08);
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
	margin: 0;
	min-height: 100vh;
	background:
		radial-gradient(circle at 12% 0%, rgba(20, 184, 166, 0.08), transparent 28rem),
		var(--canvas);
	color: var(--ink);
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
	-webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.topbar {
	height: 66px;
	padding: 0 max(20px, calc((100vw - 1080px) / 2));
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	background: rgba(255,255,255,.9);
	border-bottom: 1px solid var(--line);
	backdrop-filter: blur(14px);
	position: sticky;
	top: 0;
	z-index: 10;
}

.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-weight: 750; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: white; background: linear-gradient(145deg, #0d9488, #115e59); box-shadow: 0 5px 12px rgba(15,118,110,.22); }
.brand-mark svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.offline-badge { display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border: 1px solid #a7f3d0; border-radius: 999px; background: var(--primary-soft); color: #047857; font-size: 13px; font-weight: 650; }
.offline-badge i { width: 7px; height: 7px; border-radius: 50%; background: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,.14); }

main { width: min(1080px, calc(100% - 40px)); margin: 0 auto; padding: 58px 0 72px; }
.hero { text-align: center; max-width: 720px; margin: 0 auto 34px; }
.eyebrow, .section-kicker { margin: 0 0 10px; color: var(--primary); font-size: 12px; font-weight: 800; letter-spacing: .14em; }
.hero h1 { margin: 0; font-size: clamp(30px, 5vw, 46px); line-height: 1.16; letter-spacing: -.035em; }
.hero p { max-width: 650px; margin: 18px auto 0; color: var(--muted); font-size: 16px; line-height: 1.75; }

.workspace-card, .help-card, .results {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: 18px;
	box-shadow: var(--shadow);
}
.workspace-card { overflow: hidden; }
.tabs { padding: 8px; display: grid; grid-template-columns: 1fr 1fr; background: #f0f5f4; border-bottom: 1px solid var(--line); }
.tab { border: 0; border-radius: 10px; padding: 11px; color: var(--muted); background: transparent; font-weight: 700; cursor: pointer; transition: .18s; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--primary-dark); background: white; box-shadow: 0 2px 8px rgba(15,74,68,.08); }
.tab:focus-visible, .btn:focus-visible, .drop-zone:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid rgba(20,184,166,.24); outline-offset: 2px; }
.tab-panel { padding: 24px; }

.drop-zone { padding: 58px 24px; border: 2px dashed #b7ceca; border-radius: 14px; background: linear-gradient(180deg, #fbfefd, #f6fbfa); text-align: center; cursor: pointer; transition: .2s; }
.drop-zone:hover, .drop-zone.dragging { border-color: #14b8a6; background: #f0fdfa; transform: translateY(-1px); }
.upload-icon { width: 58px; height: 58px; margin: 0 auto 16px; display: grid; place-items: center; border-radius: 17px; color: var(--primary); background: #ccfbf1; }
.upload-icon svg { width: 29px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.drop-zone h2 { margin: 0; font-size: 19px; }
.drop-zone p { margin: 9px 0 22px; color: var(--muted); font-size: 14px; }

.field-label { display: block; margin-bottom: 9px; font-size: 14px; font-weight: 750; }
textarea { width: 100%; min-height: 260px; resize: vertical; padding: 15px; border: 1px solid #cbd8d6; border-radius: 12px; color: var(--ink); background: #fbfdfd; line-height: 1.55; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.paste-actions { margin-top: 13px; display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }

.btn { border: 1px solid transparent; border-radius: 10px; padding: 10px 15px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: 14px; font-weight: 700; cursor: pointer; transition: .18s; }
.btn-primary { color: white; background: var(--primary); box-shadow: 0 5px 12px rgba(15,118,110,.18); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-secondary { color: #334155; background: white; border-color: #cbd5e1; }
.btn-secondary:hover { background: #f8fafc; border-color: #94a3b8; }
.btn-danger { color: var(--danger); background: var(--danger-soft); border-color: #fecdd3; }
.btn-danger:hover { background: #ffe4e6; }
.btn-small { padding: 6px 9px; border-radius: 8px; font-size: 12px; }

.message { margin-top: 18px; padding: 13px 15px; border: 1px solid; border-radius: 11px; font-size: 14px; line-height: 1.5; }
.message.error { color: #9f1239; background: #fff1f2; border-color: #fecdd3; }
.message.success { color: #065f46; background: #ecfdf5; border-color: #a7f3d0; }
.hidden { display: none !important; }

.results { margin-top: 24px; padding: 24px; }
.results-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 20px; }
.section-kicker { margin-bottom: 6px; }
.results h2 { margin: 0; font-size: 24px; letter-spacing: -.025em; }
.source-name { margin: 6px 0 0; color: var(--muted); font-size: 13px; word-break: break-all; }
.toolbar { display: flex; align-items: center; gap: 8px; }
.search-box { min-width: 235px; display: flex; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid #cbd5e1; border-radius: 10px; background: white; }
.search-box:focus-within { border-color: #14b8a6; box-shadow: 0 0 0 3px rgba(20,184,166,.12); }
.search-box svg { width: 17px; flex: 0 0 auto; fill: none; stroke: #64748b; stroke-width: 2; stroke-linecap: round; }
.search-box input { width: 100%; border: 0; outline: 0; padding: 10px 0; color: var(--ink); background: transparent; font-size: 13px; }

.connection-list { display: grid; gap: 12px; }
.connection-card { border: 1px solid var(--line); border-radius: 13px; overflow: hidden; background: #fcfefd; }
.connection-summary { width: 100%; padding: 16px; border: 0; background: transparent; display: flex; align-items: center; gap: 13px; color: inherit; text-align: left; cursor: pointer; }
.connection-summary:hover { background: #f4faf8; }
.db-icon { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; color: var(--primary); background: #dff7f1; font-weight: 800; font-size: 12px; text-transform: uppercase; }
.summary-main { flex: 1; min-width: 0; }
.summary-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 750; }
.summary-subtitle { display: block; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }
.profile-count { padding: 4px 8px; border-radius: 999px; color: #475569; background: #e9efee; font-size: 11px; font-weight: 700; }
.chevron { width: 18px; fill: none; stroke: var(--muted); stroke-width: 2; transition: transform .18s; }
.connection-card.open .chevron { transform: rotate(180deg); }
.connection-details { display: none; border-top: 1px solid var(--line); padding: 17px; background: white; }
.connection-card.open .connection-details { display: block; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; }
.detail { min-width: 0; }
.detail-label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
.detail-value { display: flex; align-items: center; gap: 7px; min-height: 30px; word-break: break-all; font-size: 14px; }
.password-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.password-text.masked { letter-spacing: .12em; }
.status-error { color: var(--danger); }
.profiles { margin-top: 18px; padding-top: 17px; border-top: 1px solid var(--line); }
.profiles h3 { margin: 0 0 11px; font-size: 13px; }
.profile-row { display: grid; grid-template-columns: 1.2fr 1fr 1.5fr; gap: 12px; padding: 11px 12px; border-radius: 9px; background: #f5f8f7; font-size: 13px; }
.profile-row + .profile-row { margin-top: 7px; }
.empty-result { padding: 38px; border: 1px dashed var(--line); border-radius: 12px; text-align: center; color: var(--muted); }

.help-card { margin-top: 24px; padding: 20px 22px; display: flex; gap: 14px; box-shadow: none; }
.help-icon { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--primary); font-family: Georgia, serif; font-weight: bold; }
.help-card h2 { margin: 2px 0 6px; font-size: 15px; }
.help-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.toast { position: fixed; left: 50%; bottom: 26px; z-index: 30; max-width: calc(100% - 32px); padding: 10px 15px; border-radius: 10px; color: white; background: #0f2926; box-shadow: 0 12px 30px rgba(0,0,0,.18); font-size: 13px; opacity: 0; transform: translate(-50%, 12px); pointer-events: none; transition: .22s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 820px) {
	main { width: min(100% - 28px, 1080px); padding-top: 40px; }
	.results-head { align-items: stretch; flex-direction: column; }
	.toolbar { flex-wrap: wrap; }
	.search-box { min-width: 100%; }
}

@media (max-width: 560px) {
	.topbar { padding: 0 14px; }
	.brand > span:last-child { font-size: 14px; }
	.offline-badge { padding: 7px; font-size: 0; }
	.hero { margin-bottom: 25px; }
	.hero h1 { font-size: 31px; }
	.tab-panel { padding: 14px; }
	.drop-zone { padding: 42px 15px; }
	.results { padding: 16px; }
	.toolbar .btn { flex: 1; }
	.detail-grid { grid-template-columns: 1fr; }
	.profile-row { grid-template-columns: 1fr; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
