:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #fff;
  --surface-soft: #f8fafc;
  --line: #d8dee8;
  --soft-line: #edf0f4;
  --text: #101828;
  --muted: #667085;
  --faint: #98a2b3;
  --blue: #007aff;
  --green: #138a43;
  --red: #d92d20;
  --orange: #a85d00;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 12px 24px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px 10px;
}

.topbar > div {
  min-width: 0;
}

.eyebrow,
h1,
p {
  margin: 0;
}

.eyebrow {
  color: var(--blue);
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0;
  font-weight: 800;
}

h1 {
  margin-top: 5px;
  font-size: 24px;
  line-height: 1.05;
  font-weight: 850;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--blue);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.status-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 34px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.status-row > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  background: #eef8f1;
  color: var(--green);
  padding: 0 10px;
  font-weight: 800;
  white-space: nowrap;
}

.pill.is-warn {
  background: #fff5e8;
  color: var(--orange);
}

.panel,
.editor-panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.room-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 10px;
}

label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

label span,
.editor-head span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  outline: none;
}

input,
select {
  min-height: 38px;
  padding: 0 10px;
  font-size: 16px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(0, 122, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

button.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

button.secondary {
  color: var(--blue);
}

button.danger {
  color: var(--red);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.editor-panel {
  margin-top: 9px;
  overflow: hidden;
}

.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 10px;
  border-bottom: 1px solid var(--soft-line);
}

.editor-head > div {
  min-width: 0;
}

.editor-head b {
  display: block;
  margin-top: 5px;
  color: var(--text);
  font-size: 14px;
  line-height: 1;
}

.icon-button {
  min-width: 58px;
  min-height: 32px;
  font-size: 13px;
}

textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 42vh;
  max-height: 62vh;
  resize: vertical;
  overflow-x: hidden;
  border: 0;
  border-radius: 0;
  background: #fff;
  padding: 12px;
  font-size: 16px;
  line-height: 1.45;
}

textarea:focus {
  box-shadow: none;
}

textarea:disabled {
  color: var(--faint);
  background: #fbfcfd;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--soft-line);
}

.toolbar button {
  min-width: 0;
  padding: 0 6px;
  white-space: nowrap;
}

.privacy-line {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 10px;
  padding: 0 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.privacy-line span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 760px) {
  .app-shell {
    width: min(100vw, 720px);
    max-width: 720px;
  }

  .room-panel {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 104px 88px 104px;
    align-items: end;
  }

  textarea {
    min-height: 48vh;
  }
}

@media (max-width: 759px) {
  .app-shell {
    width: 100%;
    max-width: none;
    margin: 0;
    overflow-x: hidden;
    padding: max(12px, env(safe-area-inset-top)) 12px calc(24px + env(safe-area-inset-bottom));
  }

  .ghost-link {
    display: none;
  }

  textarea {
    min-height: 34vh;
    max-height: 48vh;
  }

  .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 360px) {
  h1 {
    font-size: 22px;
  }
}
