@font-face { font-family: 'Poppins'; font-weight: 600; font-display: swap; src: url('/fonts/poppins-600.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 700; font-display: swap; src: url('/fonts/poppins-700.woff2') format('woff2'); }
@font-face { font-family: 'Libre Franklin'; font-weight: 400; font-display: swap; src: url('/fonts/libre-franklin-400.woff2') format('woff2'); }
@font-face { font-family: 'Libre Franklin'; font-weight: 600; font-display: swap; src: url('/fonts/libre-franklin-600.woff2') format('woff2'); }

:root {
  color-scheme: light dark;
  --bg: #F2F2F7; --card: #FFFFFF; --fg: #111111; --muted: #69727D; --line: #E5E5EA;
  --accent: #EC190B; --accent-fg: #FFFFFF; --ok: #1F8A4C; --warn: #B26B00; --error: #C4140A;
  --radius: 12px;
  --font-body: 'Libre Franklin', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-head: 'Poppins', var(--font-body);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #000000; --card: #1C1C1E; --fg: #F2F2F7; --muted: #A1A8B0; --line: #38383A; --accent: #FF3B2F; --ok: #34C759; --warn: #FFB340; --error: #FF6B60; }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 16px/1.45 var(--font-body); -webkit-font-smoothing: antialiased; min-height: 100vh; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; margin: 0 0 12px; }
h1 { font-size: 26px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }

.topbar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-family: var(--font-head); font-weight: 700; font-size: 20px; letter-spacing: 0.5px; }
.brand-kam { color: var(--accent); }
.brand-on { color: var(--muted); }
.brand-product { margin-left: 8px; font-weight: 600; font-size: 15px; color: var(--fg); }
.status { font-size: 13px; color: var(--muted); }
.status[data-kind="ok"] { color: var(--ok); }
.status[data-kind="warn"] { color: var(--warn); }
.status[data-kind="error"] { color: var(--error); }

.app { max-width: 640px; margin: 0 auto; padding: 16px 16px calc(32px + env(safe-area-inset-bottom)); }
.card { background: var(--card); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.muted { color: var(--muted); font-size: 14px; }
.error { color: var(--error); min-height: 1.2em; margin: 8px 0 0; font-size: 14px; }

label { display: block; font-size: 14px; color: var(--muted); margin: 12px 0 4px; }
input, textarea { display: block; width: 100%; margin-top: 4px; padding: 11px 12px; font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
meter { display: block; width: 100%; height: 8px; margin-top: 6px; }

button { font: inherit; cursor: pointer; border: 0; border-radius: 10px; padding: 11px 16px; background: var(--bg); color: var(--fg); }
button.primary { width: 100%; margin-top: 16px; background: var(--accent); color: var(--accent-fg); font-weight: 600; }
button.link { background: none; color: var(--accent); padding: 8px 0; }
button.danger { color: var(--error); }
button:disabled { opacity: 0.6; cursor: progress; }

.inline { display: flex; gap: 8px; align-items: center; }
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; }
.toolbar input { margin: 0; }
.list { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: var(--radius); overflow: hidden; }
.list li + li { border-top: 1px solid var(--line); }
.row { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; background: none; border-radius: 0; padding: 12px 16px; }
.row-title { font-weight: 600; }
.row-sub { font-size: 13px; color: var(--muted); }
.fields { margin: 0; }
.fields dt { font-size: 13px; color: var(--muted); margin-top: 14px; }
.fields dd { margin: 2px 0 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; word-break: break-word; }
.notes { white-space: pre-wrap; }
.secret { font-family: ui-monospace, Menlo, monospace; }
.actions, .footer { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.footer { justify-content: center; }
.code { font-family: ui-monospace, Menlo, monospace; word-break: break-all; padding: 12px; background: var(--bg); border-radius: 10px; user-select: all; }
.preview { max-height: 240px; overflow: auto; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); max-width: min(92vw, 520px); padding: 12px 16px; border-radius: 12px; background: var(--fg); color: var(--bg); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast[data-kind="error"] { background: var(--error); color: #FFFFFF; }
[hidden] { display: none !important; }
