:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  color: #172b4d;
  background: #eef1f5;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

button, textarea { font: inherit; }

.app-header {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  border-bottom: 1px solid #d7dce3;
  background: #ffffff;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 7px;
  color: #ffffff;
  background: #0052cc;
  font-size: 12px;
  font-weight: 800;
}

.brand-copy h1,
.brand-copy p { margin: 0; letter-spacing: 0; }

.brand-copy h1 { font-size: 18px; line-height: 1.15; }
.brand-copy p { margin-top: 2px; color: #6b778c; font-size: 12px; }

.state {
  margin-left: auto;
  padding: 5px 8px;
  border: 1px solid #d7dce3;
  border-radius: 4px;
  color: #5e6c84;
  background: #f7f8fa;
  font-size: 12px;
  font-weight: 650;
}

.state[data-format="rich"] {
  border-color: #79f2c0;
  color: #006644;
  background: #e3fcef;
}

.state[data-format="plain"] {
  border-color: #ffab00;
  color: #974f0c;
  background: #fffae6;
}

.workspace {
  width: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1px;
  background: #d7dce3;
}

.panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 18px 20px 20px;
  background: #f7f8fa;
}

.panel-header {
  min-height: 46px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel h2 {
  margin: 0;
  color: #253858;
  font-size: 14px;
  line-height: 1.3;
  letter-spacing: 0;
}

.count {
  display: block;
  min-height: 16px;
  margin-top: 3px;
  color: #7a869a;
  font-size: 11px;
}

.paste-area,
textarea {
  width: 100%;
  height: 100%;
  min-height: 520px;
  overflow: auto;
  padding: 18px;
  border: 1px solid #b7bec8;
  border-radius: 6px;
  outline: none;
  color: #172b4d;
  background: #ffffff;
  line-height: 1.55;
}

.paste-area:empty::before {
  color: #8993a4;
  content: attr(data-placeholder);
  pointer-events: none;
}

.paste-area:focus,
textarea:focus {
  border-color: #4c9aff;
  box-shadow: 0 0 0 2px #deebff;
}

.paste-area h1 { font-size: 24px; }
.paste-area h2 { font-size: 19px; }
.paste-area h3 { font-size: 16px; }
.paste-area h1, .paste-area h2, .paste-area h3, .paste-area h4 { letter-spacing: 0; }
.paste-area table { width: 100%; border-collapse: collapse; }
.paste-area th, .paste-area td { padding: 7px 9px; border: 1px solid #cfd5dd; text-align: left; vertical-align: top; }
.paste-area th { background: #edf2f7; }
.paste-area pre { overflow: auto; padding: 10px; background: #f1f3f5; }
.paste-area code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

textarea {
  resize: none;
  font: 12px/1.6 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

button {
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 5px;
  font-weight: 700;
  cursor: pointer;
}

.primary-button { border: 1px solid #0052cc; color: #ffffff; background: #0052cc; }
.primary-button:hover:not(:disabled) { border-color: #0747a6; background: #0747a6; }
.secondary-button { border: 1px solid #b7bec8; color: #344563; background: #ffffff; }
.secondary-button:hover:not(:disabled) { background: #ebecf0; }
button:focus-visible { outline: 2px solid #4c9aff; outline-offset: 2px; }
button:disabled { border-color: #dfe1e6; color: #a5adba; background: #ebecf0; cursor: default; }

@media (max-width: 800px) {
  .app-header { flex-wrap: wrap; padding-inline: 16px; }
  .state { width: 100%; margin-left: 0; text-align: center; }
  .workspace { grid-template-columns: 1fr; grid-template-rows: minmax(520px, 1fr) minmax(520px, 1fr); }
  .panel { padding: 16px; }
  .paste-area, textarea { min-height: 430px; }
}
