:root {
  color-scheme: light;
  --bg: #eef5f8;
  --surface: #ffffff;
  --surface-2: #f7fafb;
  --line: #cfdde5;
  --line-strong: #9fb6c3;
  --text: #122436;
  --muted: #637486;
  --accent: #147fa0;
  --accent-dark: #0a526d;
  --red: #d84b55;
  --green: #247c5a;
  --shadow: 0 16px 36px rgba(14, 37, 54, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Yu Gothic UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0)), var(--bg);
}

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

button {
  cursor: pointer;
}

h1,
h2,
p {
  margin: 0;
}

.app-shell {
  width: min(1360px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 8px 0 18px;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--accent-dark);
}

h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

.status-box {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 13px;
}

.status-box span {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

.status-box strong {
  color: var(--text);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.85fr) minmax(440px, 1.15fr);
  gap: 16px;
  align-items: start;
}

.input-panel,
.draft-panel,
.history-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.input-panel,
.draft-panel {
  min-height: 560px;
}

.history-panel {
  margin-top: 16px;
}

.quick-box {
  display: grid;
  gap: 12px;
  padding: 18px;
  background: linear-gradient(135deg, rgba(20, 127, 160, 0.1), rgba(216, 75, 85, 0.08)), #ffffff;
}

.quick-title {
  font-size: 22px;
  font-weight: 900;
  line-height: 1.25;
}

.quick-copy {
  color: var(--muted);
  line-height: 1.6;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-head.compact {
  border-top: 1px solid var(--line);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 18px 0;
}

label,
.full-field {
  display: grid;
  gap: 7px;
}

label span {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  padding: 10px 11px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.58;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 127, 160, 0.15);
}

.full-field {
  padding: 14px 18px 0;
}

.advanced {
  margin: 16px 18px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.advanced summary {
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 800;
  color: var(--accent-dark);
}

.advanced-grid {
  padding: 4px 14px 0;
}

.advanced-field {
  padding: 14px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button,
.ghost-button,
.draft-actions button {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 40px;
  padding: 0 14px;
  font-weight: 800;
}

.primary-button {
  color: #ffffff;
  background: var(--accent-dark);
}

.primary-button.wide {
  width: 100%;
  min-height: 52px;
  font-size: 16px;
}

.ghost-button.wide {
  width: 100%;
}

.primary-button:hover {
  background: #073f55;
}

.secondary-button {
  color: #ffffff;
  background: var(--accent);
}

.secondary-button:hover {
  background: #106f8d;
}

.ghost-button,
.draft-actions button {
  color: var(--accent-dark);
  background: #edf7fa;
  border-color: #b9dbe7;
}

.ghost-button:hover,
.draft-actions button:hover {
  background: #dff1f6;
}

.status-text,
.limit-note,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.drafts {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.draft-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  overflow: hidden;
}

.draft-card.is-alert {
  border-color: rgba(216, 75, 85, 0.5);
}

.draft-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  padding: 12px 12px 0;
}

.draft-label {
  display: block;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 2px;
}

.pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid currentColor;
}

.pill.ok {
  color: var(--green);
  background: rgba(36, 124, 90, 0.08);
}

.pill.bad {
  color: var(--red);
  background: rgba(216, 75, 85, 0.08);
}

.draft-text {
  margin: 12px;
  width: calc(100% - 24px);
  min-height: 142px;
  background: #ffffff;
}

.warnings {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 12px 12px;
}

.warning,
.fine {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}

.warning {
  color: #7c2c2c;
  background: #fff0f0;
  border: 1px solid #f0b9b9;
}

.fine {
  color: var(--green);
  background: #edf8f3;
  border: 1px solid #bfe1d1;
}

.draft-actions {
  display: flex;
  gap: 8px;
  padding: 0 12px 12px;
  flex-wrap: wrap;
}

.empty-state {
  display: grid;
  gap: 6px;
  place-items: center;
  min-height: 360px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state p {
  color: var(--text);
  font-weight: 800;
}

.history-list {
  display: grid;
  gap: 8px;
  padding: 14px 18px 18px;
}

.news-panel {
  margin: 0 18px 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.news-panel h2 {
  margin-bottom: 10px;
}

.news-list {
  display: grid;
  gap: 8px;
}

.news-item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.news-item:hover {
  border-color: var(--accent);
}

.news-item span {
  color: var(--muted);
  font-size: 12px;
}

.news-item strong {
  line-height: 1.45;
}

.history-item {
  display: grid;
  gap: 4px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 10px 12px;
  color: var(--text);
}

.history-item:hover {
  border-color: var(--accent);
}

.history-item span {
  color: var(--muted);
  font-size: 12px;
}

.history-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

@media (max-width: 920px) {
  .topbar {
    align-items: start;
    flex-direction: column;
  }

  .status-box {
    justify-content: start;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .input-panel,
  .draft-panel {
    min-height: 0;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 1360px);
    padding-top: 12px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .panel-head,
  .form-actions,
  .draft-head {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button,
  .secondary-button,
  .ghost-button,
  .draft-actions button {
    width: 100%;
  }
}
