: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: 60px;
	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(1120px, calc(100% - 40px)); margin: 0 auto; padding: 38px 0 54px; }
.hero { text-align: center; max-width: 720px; margin: 0 auto 24px; }
.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(28px, 4vw, 40px); line-height: 1.16; letter-spacing: -.035em; }
.hero p { max-width: 650px; margin: 12px auto 0; color: var(--muted); font-size: 15px; line-height: 1.65; }

.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: 18px; }

.drop-zone { padding: 38px 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: 48px; height: 48px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 14px; color: var(--primary); background: #ccfbf1; }
.upload-icon svg { width: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.drop-zone h2 { margin: 0; font-size: 18px; }
.drop-zone p { margin: 7px 0 16px; color: var(--muted); font-size: 13px; }

.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: 18px; padding: 18px; }
.results-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 14px; }
.section-kicker { margin-bottom: 6px; }
.results h2 { margin: 0; font-size: 21px; 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; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 10px; }
.connection-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fcfefd; }
.connection-summary { width: 100%; padding: 11px 12px; border: 0; background: transparent; display: flex; align-items: center; gap: 10px; color: inherit; text-align: left; cursor: pointer; }
.connection-summary:hover { background: #f4faf8; }
.db-icon { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; color: var(--primary); background: #dff7f1; font-weight: 800; font-size: 10px; text-transform: uppercase; }
.summary-main { flex: 1; min-width: 0; }
.summary-title-line { display: flex; align-items: center; gap: 7px; min-width: 0; }
.summary-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 750; }
.type-tag { flex: 0 0 auto; padding: 2px 6px; border-radius: 5px; color: var(--primary-dark); background: #dff7f1; font-size: 9px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.summary-subtitle { display: flex; align-items: center; gap: 5px; margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 11px; }
.summary-subtitle > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta-divider { flex: 0 0 auto; color: #b4c1bf; }
.profile-count { flex: 0 0 auto; padding: 3px 7px; border-radius: 999px; color: #475569; background: #e9efee; font-size: 10px; font-weight: 700; }
.chevron { width: 16px; flex: 0 0 auto; 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: 10px 12px 12px; background: white; }
.connection-card.open .connection-details { display: block; }
.password-row { min-width: 0; display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; gap: 8px; }
.row-label { color: var(--muted); font-size: 11px; font-weight: 700; }
.password-control { min-width: 0; display: flex; align-items: center; gap: 5px; }
.password-text { min-width: 76px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.password-text.masked { letter-spacing: .12em; }
.password-empty { color: #94a3b8; font-size: 12px; }
.password-error { color: var(--danger); font-size: 11px; line-height: 1.35; }
.text-action { flex: 0 0 auto; border: 0; padding: 3px 5px; border-radius: 5px; color: var(--primary); background: transparent; font-size: 11px; font-weight: 700; cursor: pointer; }
.text-action:hover { background: var(--primary-soft); }
.profiles { margin-top: 9px; padding-top: 9px; border-top: 1px solid #edf2f1; }
.profiles-head { margin-bottom: 6px; display: flex; justify-content: space-between; align-items: center; }
.profiles-head h3 { margin: 0; font-size: 11px; }
.profiles-head > span { color: var(--muted); font-size: 10px; }
.profile-row { display: grid; grid-template-columns: minmax(90px, .8fr) minmax(165px, 1.2fr); align-items: center; gap: 8px; padding: 7px 8px; border-radius: 7px; background: #f5f8f7; font-size: 12px; }
.profile-row + .profile-row { margin-top: 5px; }
.profile-identity { min-width: 0; }
.profile-identity strong, .profile-identity span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-identity strong { font-size: 11px; }
.profile-identity span { margin-top: 1px; color: var(--muted); font-size: 10px; }
.empty-result { padding: 38px; border: 1px dashed var(--line); border-radius: 12px; text-align: center; color: var(--muted); }

.help-card { margin-top: 18px; padding: 16px 18px; display: flex; gap: 12px; 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, 1120px); padding-top: 30px; }
	.results-head { align-items: stretch; flex-direction: column; }
	.toolbar { flex-wrap: wrap; }
	.search-box { min-width: 100%; }
	.connection-list { grid-template-columns: 1fr; }
}

@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: 20px; }
	.hero h1 { font-size: 29px; }
	.tab-panel { padding: 14px; }
	.drop-zone { padding: 30px 15px; }
	.results { padding: 13px; }
	.toolbar .btn { flex: 1; }
	.profile-count { display: none; }
	.profile-row { grid-template-columns: minmax(82px, .7fr) minmax(0, 1.3fr); }
}

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