:root {
  color-scheme: light;
  --bg: #f8f9fa;
  --surface: #ffffff;
  --border: #dadce0;
  --text: #202124;
  --text-muted: #5f6368;
  --primary: #1a73e8;
  --primary-hover: #1765cc;
  --error: #d93025;
  --shadow: 0 1px 2px rgba(60, 64, 67, 0.15);
  --topbar-height: 56px;
  --font: Roboto, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--topbar-height);
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.topbar-start {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.app-mark {
  font-size: 20px;
  color: var(--primary);
}

.doc-title {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 8px 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:not(:disabled):hover {
  background: #f1f3f4;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:not(:disabled):hover {
  background: var(--primary-hover);
}

.status {
  margin: 0;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-muted);
  background: #e8f0fe;
  border-bottom: 1px solid #d2e3fc;
}

.status[data-kind='error'] {
  color: var(--error);
  background: #fce8e6;
  border-bottom-color: #f6aea9;
}

.preview-shell {
  flex: 1;
  min-height: 0;
  display: flex;
}

#preview {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
}

@media (max-width: 720px) {
  .topbar {
    flex-wrap: wrap;
    padding: 8px 12px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .doc-title {
    font-size: 16px;
  }
}
