:root {
  --ink: #25211f;
  --sub: #6f6864;
  --line: #d9d4d0;
  --line-strong: #bdb5b0;
  --surface: #ffffff;
  --surface-soft: #f6f5f3;
  --coral: #b44f70;
  --coral-dark: #8f3655;
  --green: #477568;
  --danger: #a13f3f;
  --focus: rgba(180, 79, 112, 0.18);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN",
    "Yu Gothic", "Meiryo", sans-serif;
  font-synthesis: weight style;
}

@media (max-width: 768px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="button"]):not([type="submit"]):not([type="reset"]),
  select,
  textarea,
  [contenteditable="true"] { font-size: 16px !important; }
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 0;
  margin: 0;
  background: #eeece9;
  color: var(--ink);
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.notice-header {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 9px max(18px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.notice-brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  color: inherit;
  font-family:
    -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "YuGothic",
    "Segoe UI", sans-serif;
  text-decoration: none;
}

.notice-brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.notice-brand span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.notice-brand strong {
  font-family: inherit;
  font-size: 15px;
  line-height: 1.2;
  white-space: nowrap;
}

.notice-brand small {
  color: var(--sub);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.notice-session {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.notice-session > span {
  max-width: 260px;
  overflow: hidden;
  color: var(--sub);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notice-shell {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 32px 0 72px;
}

.login-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(320px, 1.2fr);
  gap: 42px;
  align-items: start;
  max-width: 860px;
  margin: 8vh auto 0;
  padding: 34px 0;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.login-panel h1,
.editor-heading h1,
.photo-dialog h2 {
  margin: 4px 0 0;
  font-size: 28px;
  line-height: 1.35;
}

.kicker {
  margin: 0;
  color: var(--coral-dark);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

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

.login-form label,
.notice-meta-fields label,
.ai-draft-fields label,
.seo-fields label,
.photo-dialog label {
  display: grid;
  gap: 6px;
  color: var(--sub);
  font-size: 12px;
  font-weight: 800;
}

.login-form input,
.notice-meta-fields input,
.notice-meta-fields select,
.ai-draft-fields input,
.ai-draft-fields select,
.ai-draft-fields textarea,
.seo-fields input,
.seo-fields textarea,
.photo-dialog input,
.photo-dialog textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
}

.notice-meta-fields label {
  min-width: 0;
}

.notice-meta-fields input[type="date"] {
  display: block;
  inline-size: 100%;
  min-inline-size: 0;
  max-inline-size: 100%;
}

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

.primary-button,
.secondary-button,
.quiet-button,
.danger-button,
.back-link {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

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

.primary-button:hover {
  background: var(--coral-dark);
}

.secondary-button {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.quiet-button,
.back-link {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.quiet-button:hover,
.back-link:hover {
  border-color: var(--coral);
}

.danger-button {
  border-color: #d7aaaa;
  background: #fff;
  color: var(--danger);
}

.primary-button:disabled,
.secondary-button:disabled,
.quiet-button:disabled,
.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.form-message {
  min-height: 18px;
  margin: 0;
  color: var(--sub);
  font-size: 12px;
  line-height: 1.5;
}

.form-message.is-error {
  color: var(--danger);
}

.editor-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line-strong);
}

.editor-heading .back-link {
  min-height: 32px;
  margin-bottom: 16px;
  padding: 5px 10px;
}

.editor-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.save-status {
  color: var(--sub);
  font-size: 12px;
  font-weight: 800;
}

.save-status.is-dirty {
  color: var(--coral-dark);
}

.notice-meta-fields {
  display: grid;
  grid-template-columns: 180px 220px minmax(0, 1fr);
  gap: 14px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.ai-draft-panel,
.seo-panel {
  border-bottom: 1px solid var(--line);
}

.ai-draft-panel summary,
.seo-panel summary {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  list-style-position: inside;
  font-size: 14px;
  font-weight: 900;
}

.ai-draft-panel summary span {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
}

.ai-draft-panel summary small {
  color: var(--sub);
  font-size: 11px;
  font-weight: 600;
}

.ai-draft-fields {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 260px;
  gap: 14px;
  padding: 0 0 20px;
}

.ai-memo-field,
.ai-draft-action {
  grid-column: 1 / -1;
}

.ai-draft-action {
  display: flex;
  align-items: center;
  gap: 14px;
}

.notice-body-section {
  padding: 24px 0;
}

.body-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 8px;
}

.body-section-heading > span {
  font-size: 13px;
  font-weight: 900;
}

.body-section-heading small {
  color: var(--sub);
  font-size: 11px;
}

.editor-surface {
  position: relative;
  border: 1px solid var(--line-strong);
  background: var(--surface);
}

#notice-editor .ql-editor em,
#notice-editor .ql-editor i {
  font-style: oblique;
  font-style: oblique 12deg;
  font-synthesis: style;
}

.notice-toolbar-sticky {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line-strong);
  background: #f3f1ee;
  box-shadow: 0 2px 8px rgba(37, 33, 31, 0.08);
}

.notice-toolbar-row {
  display: flex;
  min-height: 50px;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  overflow: visible;
  padding: 7px 8px;
  white-space: normal;
}

#notice-toolbar.ql-toolbar.ql-snow {
  display: flex;
  width: 100%;
  flex: 1 1 100%;
  min-height: 34px;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  overflow: visible;
  padding: 0;
  border: 0;
  white-space: normal;
}

#notice-toolbar .ql-formats {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding-right: 5px;
  border-right: 1px solid var(--line);
}

#notice-toolbar button,
#notice-toolbar select {
  min-width: 30px;
  height: 34px;
}

#notice-toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

#notice-toolbar button:hover,
#notice-toolbar button.ql-active {
  background: #fff;
}

#notice-toolbar svg {
  display: block;
  width: 20px;
  height: 20px;
  pointer-events: none;
}

#notice-toolbar .ql-stroke,
#notice-toolbar .ql-stroke-miter {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

#notice-toolbar .ql-stroke-miter {
  stroke-miterlimit: 10;
}

#notice-toolbar .ql-fill,
#notice-toolbar .ql-stroke.ql-fill {
  fill: currentColor;
}

#notice-toolbar .ql-empty {
  fill: none;
}

#notice-toolbar .ql-even {
  fill-rule: evenodd;
}

#notice-toolbar .ql-thin,
#notice-toolbar .ql-stroke.ql-thin {
  stroke-width: 1;
}

#notice-toolbar .ql-transparent {
  opacity: 0.45;
}

#notice-toolbar button.ql-active,
#notice-toolbar .ql-picker-label.ql-active {
  color: var(--coral-dark);
}

#notice-toolbar .ql-picker {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 34px;
  color: var(--ink);
}

#notice-toolbar .ql-picker-label {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
}

#notice-toolbar .ql-picker-label:hover,
#notice-toolbar .ql-picker.ql-expanded .ql-picker-label {
  border-color: var(--line);
  background: #fff;
}

#notice-toolbar .ql-picker-options {
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  z-index: 40;
  display: none;
  min-width: 72px;
  grid-template-columns: repeat(2, 24px);
  gap: 5px;
  padding: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 5px 14px rgba(37, 33, 31, 0.16);
}

#notice-toolbar .ql-picker.ql-expanded .ql-picker-options {
  display: grid;
}

#notice-toolbar .ql-picker-item {
  display: block;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 3px;
  cursor: pointer;
}

#notice-toolbar .ql-picker-item:not([data-value]) {
  background:
    linear-gradient(
      to bottom right,
      transparent calc(50% - 1px),
      var(--danger) 50%,
      transparent calc(50% + 1px)
    );
}

#notice-toolbar .photo-toolbar-button {
  width: 30px;
  padding: 3px 5px;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.notice-toolbar-row .history-controls {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 2px;
}

.notice-toolbar-row .history-button {
  display: inline-flex;
  width: 34px;
  min-width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  font-size: 22px;
}

.notice-toolbar-row .history-button svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.notice-toolbar-row .history-button:hover {
  background: #fff;
}

.toolbar-select-group {
  display: inline-flex;
  min-width: 0;
  flex: 0 1 auto;
  align-items: center;
  gap: 5px;
  padding-right: 6px;
  border-right: 1px solid var(--line);
}

.toolbar-select-group label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.toolbar-select-group select {
  width: 90px;
  min-width: 0;
  max-width: 100%;
  height: 34px;
  padding: 0 28px 0 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

#notice-editor.ql-container.ql-snow {
  min-height: 560px;
  border: 0;
  font-family: inherit;
}

#notice-editor .ql-editor {
  min-height: 560px;
  padding: 30px clamp(20px, 6vw, 72px) 72px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.85;
}

#notice-editor .ql-editor h2,
#notice-editor .ql-editor h3 {
  margin: 24px 0 10px;
  line-height: 1.45;
}

#notice-editor .ql-editor h2 {
  font-size: 26px;
}

#notice-editor .ql-editor h3 {
  font-size: 21px;
}

#notice-editor .ql-editor p {
  margin: 9px 0;
}

#notice-editor .ql-editor a {
  color: var(--coral-dark);
  text-decoration: underline;
}

#notice-editor .ql-editor figure {
  margin: 24px auto;
  padding: 0;
  cursor: pointer;
  text-align: center;
}

#notice-editor .ql-editor figure:hover {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

#notice-editor .ql-editor figure img {
  display: block;
  max-width: 100%;
  max-height: 620px;
  margin: 0 auto;
  border-radius: 5px;
  object-fit: contain;
}

#notice-editor .ql-editor figcaption {
  max-width: 760px;
  margin: 8px auto 0;
  color: var(--sub);
  font-size: 13px;
  line-height: 1.65;
  text-align: center;
}

.editor-help {
  margin: 8px 0 0;
  color: var(--sub);
  font-size: 11px;
  line-height: 1.6;
}

.seo-fields {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 14px;
  padding: 0 0 20px;
}

.wide-field {
  grid-column: 1 / -1;
}

.publication-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.publication-settings label {
  display: flex;
  align-items: start;
  gap: 10px;
  cursor: pointer;
}

.publication-settings input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--coral);
}

.publication-settings span {
  display: grid;
  gap: 3px;
}

.publication-settings strong {
  font-size: 13px;
}

.publication-settings small {
  color: var(--sub);
  font-size: 11px;
}

.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 22px;
}

.editor-footer .form-message {
  flex: 1;
}

.editor-footer .primary-button {
  min-width: 180px;
}

.photo-dialog {
  width: min(680px, calc(100% - 28px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}

.photo-dialog::backdrop {
  background: rgba(37, 33, 31, 0.56);
}

.photo-dialog form {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.photo-dialog header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.photo-dialog h2 {
  font-size: 22px;
}

.dialog-close {
  display: inline-grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
  font-size: 22px;
}

.photo-preview {
  display: block;
  max-width: 100%;
  max-height: 340px;
  margin: 0 auto;
  border-radius: 5px;
  object-fit: contain;
}

.photo-dialog footer {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

@media (max-width: 760px) {
  .notice-header {
    padding: 8px 12px;
  }

  .notice-brand strong {
    font-size: 15px;
  }

  .notice-session > span {
    display: none;
  }

  .notice-shell {
    width: min(100% - 24px, 1180px);
    padding-top: 20px;
  }

  .login-panel {
    grid-template-columns: 1fr;
    gap: 24px;
    margin-top: 2vh;
    padding: 24px 0;
  }

  .editor-heading {
    align-items: start;
    flex-direction: column;
  }

  .editor-heading h1 {
    font-size: 24px;
  }

  .editor-heading-actions {
    width: 100%;
    justify-content: space-between;
  }

  .notice-meta-fields,
  .ai-draft-fields,
  .seo-fields,
  .publication-settings {
    grid-template-columns: 1fr;
  }

  .notice-meta-fields input[type="date"] {
    width: -webkit-fill-available;
  }

  .notice-title-field,
  .ai-memo-field,
  .ai-draft-action,
  .wide-field {
    grid-column: auto;
  }

  .ai-draft-panel summary span {
    display: grid;
    gap: 2px;
  }

  .ai-draft-action {
    align-items: stretch;
    flex-direction: column;
  }

  .body-section-heading {
    align-items: start;
    flex-direction: column;
    gap: 3px;
  }

  .notice-toolbar-row {
    min-height: 48px;
    gap: 4px;
    padding: 6px;
  }

  .notice-toolbar-row .history-controls {
    flex: 0 0 auto;
  }

  .notice-toolbar-row .history-button {
    width: 32px;
    min-width: 32px;
    padding: 0;
  }

  .toolbar-select-group {
    min-width: 68px;
    flex: 1 1 68px;
    gap: 2px;
    padding-right: 3px;
  }

  .toolbar-select-group select {
    width: 100%;
    padding-right: 22px;
    padding-left: 6px;
    font-size: 11px;
  }

  #notice-toolbar.ql-toolbar.ql-snow {
    gap: 4px;
  }

  #notice-toolbar .ql-formats {
    gap: 1px;
    padding-right: 3px;
  }

  #notice-editor.ql-container.ql-snow,
  #notice-editor .ql-editor {
    min-height: 460px;
  }

  #notice-editor .ql-editor {
    padding: 22px 16px 56px;
  }

  .editor-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .editor-footer .primary-button {
    width: 100%;
  }

  .photo-dialog form {
    padding: 16px;
  }

  .photo-dialog footer {
    grid-template-columns: 1fr 1fr;
  }

  .photo-dialog footer span {
    display: none;
  }
}
