/* pad-api panel — Mintlify-derived token system, dual theme.
   Light: :root / [data-theme=light]. Dark: [data-theme=dark].
   Toggle persisted in localStorage (panel.js), default follows
   prefers-color-scheme via the inline boot script in layout.html. */

:root, [data-theme="light"] {
	--brand: #00d4a4;
	--brand-deep: #00b48a;
	--brand-soft: rgba(0, 212, 164, 0.12);
	--canvas: #ffffff;
	--surface: #f7f7f7;
	--surface-soft: #fafafa;
	--hairline: #e5e5e5;
	--hairline-soft: #ededed;
	--ink: #0a0a0a;
	--slate: #3a3a3c;
	--steel: #5a5a5c;
	--muted: #a8a8aa;
	--error: #d45656;
	--error-soft: rgba(212, 86, 86, 0.10);
	--btn-primary-bg: #0a0a0a;
	--btn-primary-fg: #ffffff;
	--code-bg: #f0f0f0;
	--shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
	--checker-a: #e8e8e8;
	--checker-b: #ffffff;
}

[data-theme="dark"] {
	--brand: #00d4a4;
	--brand-deep: #7cebcb;
	--brand-soft: rgba(0, 212, 164, 0.14);
	--canvas: #0a0a0a;
	--surface: #141416;
	--surface-soft: #1c1c1e;
	--hairline: #262628;
	--hairline-soft: #1f1f1f;
	--ink: #ffffff;
	--slate: #d6d6d8;
	--steel: #a0a0a3;
	--muted: #6e6e71;
	--error: #e57373;
	--error-soft: rgba(229, 115, 115, 0.12);
	--btn-primary-bg: #ffffff;
	--btn-primary-fg: #0a0a0a;
	--code-bg: #232326;
	--shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
	--checker-a: #232326;
	--checker-b: #2c2c30;
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	padding: 0;
}

body {
	background: var(--canvas);
	color: var(--slate);
	font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	font-size: 16px;
	line-height: 1.5;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

code, .code-chip, input[type="text"].js-url {
	font-family: "Geist Mono", "SF Mono", Menlo, Consolas, monospace;
}

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

h1, h2, h3, h4 { color: var(--ink); font-weight: 600; margin: 0 0 8px; }
.h2 { font-size: 28px; line-height: 1.25; letter-spacing: -0.5px; }
.h3 { font-size: 22px; line-height: 1.3; }
.h4 { font-size: 18px; line-height: 1.4; }

.muted { color: var(--steel); }
.small { font-size: 14px; }
.center { text-align: center; }
.right { text-align: right; }
.push { margin-left: auto; }
.inline { display: inline; }

/* --- topbar --- */

.topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 24px;
	border-bottom: 1px solid var(--hairline);
	background: var(--canvas);
}

.brand {
	color: var(--ink);
	font-weight: 600;
	font-size: 18px;
	letter-spacing: -0.3px;
}
.brand span { color: var(--brand); }
.brand:hover { text-decoration: none; }

.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-email { color: var(--steel); font-size: 14px; }
.topbar-link { color: var(--steel); font-size: 14px; font-weight: 500; }
.topbar-link:hover { color: var(--ink); text-decoration: none; }

/* --- layout --- */

.container {
	width: 100%;
	max-width: 960px;
	margin: 0 auto;
	padding: 32px 24px 64px;
	flex: 1;
}

.footer {
	padding: 20px 24px;
	border-top: 1px solid var(--hairline-soft);
	color: var(--muted);
	font-size: 12px;
	text-align: center;
}

.section { margin-bottom: 40px; }
.section-head {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 8px;
}

/* --- cards --- */

.card {
	background: var(--surface-soft);
	border: 1px solid var(--hairline);
	border-radius: 12px;
	padding: 24px;
	margin: 16px 0;
	box-shadow: var(--shadow);
}

.card.notice {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	border-color: var(--brand);
	background: var(--brand-soft);
}

.card.locked { text-align: center; }
.table-card { padding: 8px 16px; }

.auth-card {
	max-width: 420px;
	margin: 48px auto;
	padding: 32px;
}

/* --- alerts / badges --- */

.alert {
	border-radius: 12px;
	padding: 12px 16px;
	margin-bottom: 16px;
	font-size: 14px;
	border: 1px solid;
}
.alert-err { background: var(--error-soft); border-color: var(--error); color: var(--error); }
.alert-ok { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-deep); }

.badge {
	display: inline-block;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.3px;
	padding: 2px 10px;
	border-radius: 999px;
	border: 1px solid var(--hairline);
	color: var(--steel);
	background: var(--surface);
}
.badge-ok { border-color: var(--brand); color: var(--brand-deep); background: var(--brand-soft); }
.badge-err { border-color: var(--error); color: var(--error); background: var(--error-soft); }

/* --- forms --- */

.stack { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }

.field { display: block; font-size: 14px; font-weight: 500; color: var(--ink); }
.field input,
.field select {
	display: block;
	width: 100%;
	margin-top: 6px;
	padding: 10px 12px;
	font-size: 15px;
	font-family: inherit;
	color: var(--ink);
	background: var(--canvas);
	border: 1px solid var(--hairline);
	border-radius: 8px;
	outline: none;
}
.field input:focus,
.field select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.hint { display: block; margin-top: 4px; font-size: 12px; font-weight: 400; color: var(--muted); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.forum-form button { margin-top: 12px; }
.forum-form button + button { margin-left: 8px; }
.check-row { display: flex; gap: 18px; margin-top: 14px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-weight: 400; cursor: pointer; white-space: nowrap; }
/* undo the block/full-width .field input rules for checkboxes */
.check input { display: inline-block; width: 16px; height: 16px; margin: 0; padding: 0; accent-color: var(--brand); }
.field input[type="color"] { padding: 4px 6px; height: 42px; cursor: pointer; }
/* the 2:3 shape must live on the CONTAINER (it owns aspect-ratio and
   overflow); an aspect on the inner iframe loses to its height:100% */
.preview-frame.preview-tall { aspect-ratio: 3 / 2; max-width: 340px; }
.preview-frame.preview-square { aspect-ratio: 1 / 1; max-width: 420px; }

.cell-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 10px; }
.cell-grid input {
	min-width: 0;
	padding: 8px 10px;
	font-size: 13px;
	font-family: inherit;
	color: var(--ink);
	background: var(--canvas);
	border: 1px solid var(--hairline);
	border-radius: 7px;
	outline: none;
}
.cell-grid input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.link-form {
	display: grid;
	grid-template-columns: 1fr 1fr auto;
	gap: 16px;
	align-items: end;
	margin-top: 12px;
}

.form-footer { margin: 24px 0; }

/* --- buttons --- */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	font-size: 14px;
	font-weight: 500;
	font-family: inherit;
	line-height: 1.3;
	padding: 10px 20px;
	border-radius: 999px;
	border: 1px solid transparent;
	cursor: pointer;
	transition: filter 0.15s, background 0.15s;
	text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(1.06); }

.btn-primary { background: var(--btn-primary-bg); color: var(--btn-primary-fg); }
.btn-secondary { background: var(--brand-soft); color: var(--brand-deep); border-color: var(--brand); }
.btn-ghost { background: transparent; color: var(--steel); border-color: var(--hairline); }
.btn-ghost:hover { color: var(--ink); }
.btn-danger { background: transparent; color: var(--error); border-color: var(--error); }
.btn-danger:hover { background: var(--error-soft); }
.btn-sm { padding: 6px 14px; font-size: 13px; }

.btn-icon {
	width: 34px;
	height: 34px;
	border-radius: 999px;
	border: 1px solid var(--hairline);
	background: var(--surface);
	color: var(--ink);
	cursor: pointer;
	font-size: 15px;
	line-height: 1;
}
.btn-icon:hover { border-color: var(--brand); }

/* --- tables --- */

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
	text-align: left;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: var(--muted);
	padding: 10px 12px;
	border-bottom: 1px solid var(--hairline);
}
.table td { padding: 12px; border-bottom: 1px solid var(--hairline-soft); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table .actions { white-space: nowrap; }
.table .actions .btn { margin-left: 6px; }

.code-chip {
	background: var(--code-bg);
	color: var(--ink);
	font-size: 13px;
	padding: 2px 8px;
	border-radius: 6px;
}

.chars-box { padding: 8px 4px 12px; font-size: 14px; }
.chars-box table { margin-top: 4px; }

/* --- widgets --- */

.widget-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 16px;
}
.widget-card { margin: 0; }
.widget-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.widget-card .widget-meta { margin: 0; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.widget-card .widget-meta:first-of-type { margin-top: 6px; }

.dropdown { position: relative; display: inline-block; }
.dropdown > summary { list-style: none; cursor: pointer; user-select: none; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-menu {
	position: absolute;
	right: 0;
	top: calc(100% + 6px);
	min-width: 190px;
	padding: 6px;
	background: var(--surface);
	border: 1px solid var(--hairline);
	border-radius: 10px;
	box-shadow: var(--shadow);
	z-index: 40;
}
.dropdown-menu a {
	display: block;
	padding: 9px 12px;
	border-radius: 7px;
	color: var(--ink);
	text-decoration: none;
	font-size: 14px;
	font-weight: 500;
}
.dropdown-menu a:hover { background: var(--brand-soft); }

.url-box { display: flex; gap: 8px; margin: 12px 0; }
.url-box input {
	flex: 1;
	font-size: 13px;
	padding: 8px 10px;
	color: var(--steel);
	background: var(--code-bg);
	border: 1px solid var(--hairline);
	border-radius: 8px;
	min-width: 0;
}

.banner-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 12px;
	margin-top: 12px;
}
.banner-opt {
	display: block;
	position: relative;
	border: 2px solid var(--hairline);
	border-radius: 8px;
	overflow: hidden;
	cursor: pointer;
	background: var(--surface);
	transition: border-color 0.15s;
}
.banner-opt img { display: block; width: 100%; height: auto; }
.banner-opt input { position: absolute; opacity: 0; pointer-events: none; }
.banner-opt:hover { border-color: var(--steel); }
.banner-opt:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.banner-opt:has(input:checked)::after {
	content: "\2713";
	position: absolute;
	top: 6px;
	right: 6px;
	width: 22px;
	height: 22px;
	border-radius: 999px;
	background: var(--brand);
	color: #ffffff;
	font-size: 14px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
}

.preview-frame {
	border: 1px solid var(--hairline);
	border-radius: 8px;
	overflow: hidden;
	margin-top: 12px;
	aspect-ratio: 5 / 1;
}
.preview-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

.checker {
	background-image:
		linear-gradient(45deg, var(--checker-a) 25%, transparent 25%, transparent 75%, var(--checker-a) 75%),
		linear-gradient(45deg, var(--checker-a) 25%, var(--checker-b) 25%, var(--checker-b) 75%, var(--checker-a) 75%);
	background-size: 24px 24px;
	background-position: 0 0, 12px 12px;
}

/* --- setup guide --- */

.guide-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.guide .card p { margin: 0 0 10px; }
.guide .card p:last-child { margin-bottom: 0; }
.guide .steps, .guide .tips { margin: 6px 0 0; padding-left: 22px; color: var(--slate); }
.guide .steps li, .guide .tips li { margin-bottom: 10px; }
.guide .steps li:last-child, .guide .tips li:last-child { margin-bottom: 0; }
.guide code {
	background: var(--code-bg);
	color: var(--ink);
	font-size: 13px;
	padding: 1px 6px;
	border-radius: 6px;
}

/* --- responsive --- */

@media (max-width: 720px) {
	.container { padding: 20px 16px 48px; }
	.link-form, .two-col { grid-template-columns: 1fr; }
	.card.notice { flex-direction: column; align-items: flex-start; }
	.topbar-email { display: none; }
}
