:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --fg: #17191c;
  --muted: #5d6673;
  --border: #d9dee7;
  --surface: #ffffff;
  --online: #168a4a;
  --offline: #bb2d3b;
  --changed: #b36b00;
  --focus: #2457d6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --fg: #f0f3f7;
    --muted: #a8b1bd;
    --border: #303640;
    --surface: #181c22;
    --focus: #7aa2ff;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.status-bar {
  min-height: 48px;
  padding: max(10px, env(safe-area-inset-top)) 12px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.status-group,
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.header-actions form {
  margin: 0;
}

.status-pill {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
}

.status-pill[data-state="online"] .status-dot,
.status-pill[data-state="clean"] .status-dot {
  background: var(--online);
}

.status-pill[data-state="offline"] .status-dot {
  background: var(--offline);
}

.status-pill[data-state="changed"] .status-dot {
  background: var(--changed);
}

#clipboard {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 18px;
  resize: none;
  border: 0;
  outline: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 16px;
  line-height: 1.5;
}

#clipboard:focus {
  box-shadow: inset 0 0 0 2px var(--focus);
}

button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  background: var(--surface);
  cursor: pointer;
}

button:hover {
  border-color: var(--focus);
}

button[data-state="copied"] {
  border-color: var(--online);
  color: var(--online);
}

button[data-state="failed"] {
  border-color: var(--offline);
  color: var(--offline);
}

.icon-button {
  min-width: 74px;
}

.login-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-shell {
  width: min(100%, 360px);
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form h1 {
  margin: 0 0 4px;
  font-size: 24px;
}

.login-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.login-form input {
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  background: var(--surface);
}

.login-error {
  margin: 0;
  color: var(--offline);
}

@media (max-width: 560px) {
  .status-bar,
  .conflict-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .status-group,
  .header-actions,
  .header-actions form {
    width: 100%;
  }

  .header-actions form,
  .header-actions button,
  .icon-button {
    width: 100%;
    min-width: 0;
  }
}
