/* =========================================================
   会社ルール翻訳 — デザイン
   ========================================================= */
:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --bg-accent: #e9eefc;
  --surface: #ffffff;
  --surface-2: #f7f9fe;
  --surface-3: #eef2fb;
  --line: #e1e7f3;
  --line-strong: #c9d4ea;
  --text: #16203a;
  --muted: #64708c;
  --primary: #4353e6;
  --primary-strong: #3241c9;
  --primary-soft: #e8ebff;
  --teal: #12a594;
  --teal-soft: #dff6f2;
  --danger: #d93a3a;
  --danger-soft: #fdeceb;
  --warn: #9a5b00;
  --warn-soft: #fff3df;
  --success: #12805c;
  --shadow-sm: 0 1px 2px rgba(22, 32, 58, 0.06);
  --shadow: 0 6px 24px rgba(22, 32, 58, 0.08);
  --shadow-lg: 0 18px 48px rgba(52, 64, 160, 0.16);
  --radius: 18px;
  --radius-sm: 12px;
  --hero-from: #4353e6;
  --hero-to: #12a594;
  --font: "Noto Sans JP", "Yu Gothic UI", "Hiragino Sans", "Meiryo", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1424;
    --bg-accent: #151c33;
    --surface: #171e33;
    --surface-2: #1c2440;
    --surface-3: #222b4a;
    --line: #2a3456;
    --line-strong: #3a4670;
    --text: #e8ecf8;
    --muted: #9aa5c4;
    --primary: #7d89ff;
    --primary-strong: #96a0ff;
    --primary-soft: #262f5e;
    --teal: #35c9b6;
    --teal-soft: #173d3b;
    --danger: #ff7b7b;
    --danger-soft: #3d1f26;
    --warn: #ffc56b;
    --warn-soft: #3b2e17;
    --success: #4fd6a6;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.45);
    --hero-from: #3644c4;
    --hero-to: #0f8a7c;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 100% -10%, var(--bg-accent), transparent 60%),
    radial-gradient(900px 420px at -10% 0%, var(--bg-accent), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
}

h1,
h2,
h3,
h4 {
  line-height: 1.35;
  letter-spacing: 0.01em;
}

a {
  color: var(--primary);
}

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

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent);
  outline-offset: 2px;
}

.muted {
  color: var(--muted);
  margin: 0;
}

/* ---------- 上部ナビ ---------- */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px max(16px, calc((100vw - 1320px) / 2 + 24px));
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--text);
  text-decoration: none;
}

.brand::before {
  content: "";
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 8l6 6M4 14l6-6 2-3M2 5h12M7 2h1M22 22l-5-10-5 10M14 18h6'/%3E%3C/svg%3E") center / 18px no-repeat,
    linear-gradient(135deg, var(--hero-from), var(--hero-to));
  box-shadow: var(--shadow-sm);
}

.nav-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.nav-links a {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.nav-links a:hover {
  background: var(--surface-3);
  color: var(--text);
}

.nav-links a.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.admin-user {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ---------- レイアウト ---------- */
.app-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px;
}

.hero {
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 28px 32px;
  margin-bottom: 24px;
  border-radius: 24px;
  color: #fff;
  background: linear-gradient(120deg, var(--hero-from), var(--hero-to));
  box-shadow: var(--shadow-lg);
}

.hero::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -120px;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 70%);
  pointer-events: none;
}

.hero > * {
  position: relative;
  z-index: 1;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 10px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.5rem, 2.6vw, 2.2rem);
}

.hero-text {
  margin: 0;
  max-width: 720px;
  line-height: 1.8;
  opacity: 0.92;
}

.stats {
  display: flex;
  gap: 12px;
}

.stat {
  display: grid;
  justify-items: center;
  min-width: 104px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(6px);
}

.stat span {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat small {
  color: inherit;
  font-size: 0.78rem;
  opacity: 0.9;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 24px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.viewer-panel {
  position: sticky;
  top: 80px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-head h2,
.panel-head h3 {
  margin: 0;
  font-size: 1.15rem;
}

.secondary-head {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

/* ---------- フォーム ---------- */
form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  font-size: 0.92rem;
}

small {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.6;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
textarea,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  background: var(--surface-2);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

input:hover,
textarea:hover,
select:hover {
  border-color: color-mix(in srgb, var(--primary) 35%, var(--line-strong));
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.7;
}

input[type="file"] {
  width: 100%;
  padding: 18px;
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

input[type="file"]:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

input[type="file"]::file-selector-button {
  margin-right: 14px;
  padding: 9px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

fieldset {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 14px 16px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

legend {
  padding: 0 8px;
  font-weight: 700;
  font-size: 0.92rem;
}

.mode-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.mode-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

input[type="radio"],
input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  margin-top: 4px;
  flex: none;
}

.lang-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.lang-count {
  margin-left: auto;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.language-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 4px;
  max-height: 230px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.lang-group-title {
  grid-column: 1 / -1;
  margin: 6px 4px 2px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.language-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.88rem;
  cursor: pointer;
}

.language-option input {
  margin-top: 0;
}

.language-option:hover {
  background: var(--surface-3);
}

.language-option:has(input:checked) {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.status-message {
  min-height: 24px;
  padding: 0;
  color: var(--success);
  font-weight: 600;
  font-size: 0.9rem;
}

.status-message:not(:empty) {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--teal-soft);
}

.status-message.error {
  color: var(--danger);
  background: var(--danger-soft);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ---------- ボタン ---------- */
.primary-btn,
.secondary-btn,
.small-btn,
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s, background 0.2s, color 0.2s;
}

.primary-btn {
  padding: 11px 20px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 70%, var(--teal)));
  box-shadow: 0 8px 20px color-mix(in srgb, var(--primary) 30%, transparent);
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px color-mix(in srgb, var(--primary) 38%, transparent);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: progress;
  transform: none;
}

.secondary-btn {
  padding: 10px 18px;
  color: var(--primary);
  background: var(--primary-soft);
}

.secondary-btn:hover {
  background: color-mix(in srgb, var(--primary-soft) 70%, var(--primary) 12%);
}

.small-btn,
.chip {
  padding: 7px 13px;
  font-size: 0.84rem;
  color: var(--text);
  background: var(--surface-3);
}

.small-btn:hover,
.chip:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.small-btn.active,
.chip.active {
  background: var(--primary);
  color: #fff;
}

.small-btn.danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.small-btn.danger:hover {
  background: var(--danger);
  color: #fff;
}

.link-btn {
  font-size: 0.88rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 700;
}

/* ---------- 読み取った日本語 ---------- */
.blocks-section {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.blocks-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.blocks-list {
  display: grid;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 2px;
}

.block-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.block-row textarea {
  flex: 1;
  min-height: 0;
  padding: 8px 11px;
}

.block-page {
  flex: none;
  margin-top: 9px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface-3);
  font-size: 0.74rem;
  color: var(--muted);
}

/* ---------- 翻訳の確認・修正 ---------- */
.review-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--line));
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--primary-soft), var(--surface) 140px);
  box-shadow: var(--shadow);
}

.review-head h3 {
  margin: 0 0 4px;
}

.review-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.review-list {
  display: grid;
  gap: 12px;
  max-height: 560px;
  overflow-y: auto;
  padding-right: 2px;
}

.review-row {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.review-ja {
  display: flex;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.6;
}

.review-num {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 700;
}

.review-row textarea {
  min-height: 0;
  font-size: 0.98rem;
}

.review-actions {
  position: sticky;
  bottom: 0;
  padding-top: 8px;
  background: linear-gradient(180deg, transparent, var(--surface) 30%);
}

/* ---------- ルール一覧 ---------- */
.list-search {
  margin-bottom: 12px;
  padding-left: 38px !important;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364708c' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") 12px center / 18px no-repeat,
    var(--surface-2) !important;
}

.manual-list {
  display: grid;
  gap: 12px;
}

.manual-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.manual-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.manual-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft), var(--shadow);
}

.manual-card h4 {
  margin: 0 0 4px;
  font-size: 1.02rem;
}

.manual-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.meta-row span {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.meta-row .pending-tag {
  background: var(--warn-soft);
  color: var(--warn);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.empty-state {
  margin: 0;
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

/* ---------- プレビュー ---------- */
.viewer-card {
  display: grid;
  gap: 14px;
}

.viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.viewer-header h3 {
  margin: 0;
}

.viewer-header p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.language-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pdf-viewer {
  display: grid;
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface-3);
}

.pdf-page {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(22, 32, 58, 0.14);
}

.pdf-loading {
  margin: 0;
  padding: 48px 0;
  text-align: center;
  color: var(--muted);
}

.pdf-loading::before {
  content: "";
  display: block;
  width: 28px;
  height: 28px;
  margin: 0 auto 12px;
  border: 3px solid var(--line-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.pdf-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.qr-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(135deg, var(--surface), var(--teal-soft));
}

.qr-card h4 {
  margin: 0 0 4px;
}

.qr-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.qr-card img {
  width: 124px;
  height: 124px;
  padding: 8px;
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.notice {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.9rem;
}

.notice.loading {
  background: var(--primary-soft);
  color: var(--primary);
}

/* ---------- ログイン ---------- */
.login-panel {
  max-width: 460px;
  margin: 0 auto 24px;
}

.login-panel h2 {
  margin-top: 0;
}

.link-text-btn {
  margin-left: auto;
  padding: 8px 4px;
  border: 0;
  background: none;
  color: var(--primary);
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- トップページ ---------- */
.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.role-card {
  display: grid;
  gap: 10px;
  justify-items: start;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.role-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--primary) 40%, var(--line));
  box-shadow: var(--shadow-lg);
}

.role-card h2,
.role-card p {
  margin: 0;
}

.role-card p {
  color: var(--muted);
  line-height: 1.8;
}

.role-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--hero-from), var(--hero-to));
  box-shadow: var(--shadow);
}

.role-icon svg {
  width: 28px;
  height: 28px;
}

.role-card .primary-btn {
  margin-top: 6px;
}

/* ---------- 利用者画面 ---------- */
.user-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 18px 16px 40px;
}

.user-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.lang-select-label {
  flex: 1;
  font-size: 0.8rem;
  color: var(--muted);
}

.lang-select-label select {
  margin-top: 4px;
  padding: 12px 14px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.user-title {
  margin: 4px 0 12px;
  font-size: 1.45rem;
}

.user-rule-list {
  display: grid;
  gap: 12px;
}

.user-rule-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
}

.user-rule-card::after {
  content: "›";
  margin-left: auto;
  font-size: 1.6rem;
  color: var(--line-strong);
}

.user-rule-card:hover,
.user-rule-card:focus-visible {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.user-rule-card h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.pdf-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 46px;
  height: 56px;
  border-radius: 10px;
  background: linear-gradient(160deg, #ff8a7a, #e5484d);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  box-shadow: 0 6px 14px rgba(229, 72, 77, 0.28);
}

.tag-muted {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 600;
}

.back-btn {
  margin-bottom: 12px;
}

.user-detail {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.user-detail-head h1 {
  margin: 0 0 4px;
  font-size: 1.35rem;
}

/* ---------- タブ ---------- */
.admin-tabs,
.user-tabs {
  display: flex;
  gap: 6px;
  padding: 5px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.admin-tabs {
  width: fit-content;
  max-width: 100%;
}

.admin-tabs .tab {
  white-space: nowrap;
}

.tab {
  position: relative;
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.tab small {
  color: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  opacity: 0.75;
}

.tab:hover {
  color: var(--text);
}

.tab.active small {
  opacity: 0.9;
}

.tab.active {
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 70%, var(--teal)));
  color: #fff;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 28%, transparent);
}

.tab-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.72rem;
  line-height: 20px;
  text-align: center;
}

/* ---------- 毎日の連絡(管理者) ---------- */
.notice-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 24px;
  align-items: start;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.form-row .grow {
  flex: 1;
  min-width: 220px;
}

.date-field input {
  width: auto;
}

input[type="date"] {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  background: var(--surface-2);
}

.notice-langs {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 0.92rem;
}

.notice-langs select {
  width: auto;
  max-width: 100%;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lang-chip {
  padding-right: 6px;
  background: var(--primary-soft);
  color: var(--primary);
}

.lang-chip button {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.lang-chip button:hover {
  background: color-mix(in srgb, var(--primary) 18%, transparent);
}

.review-row input[type="text"] {
  font-weight: 700;
}

.notice-original {
  background: var(--surface-2);
}

.notice-date-label {
  margin: 0 0 2px !important;
  color: var(--primary) !important;
  font-size: 0.8rem !important;
  font-weight: 700;
}

.notice-body-text {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.8;
}

/* ---------- お知らせ(利用者) ---------- */
.feed-intro {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.88rem;
}

.notice-feed {
  display: grid;
  gap: 22px;
}

.feed-day {
  display: grid;
  gap: 10px;
}

.feed-date {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.feed-date.is-today {
  color: var(--primary);
}

.today-badge {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 0.76rem;
}

.feed-item {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.feed-item h3 {
  margin: 0;
  font-size: 1.05rem;
}

.feed-item .small-btn {
  justify-self: start;
}

.feed-item.is-new {
  border-left-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft), var(--shadow-sm);
}

.feed-rule {
  display: flex;
  align-items: center;
  gap: 14px;
  border-left-color: var(--primary);
}

.feed-rule:hover {
  box-shadow: var(--shadow);
}

.feed-item-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.feed-kind {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 0.74rem;
  font-weight: 700;
}

.rule-kind {
  background: var(--primary-soft);
  color: var(--primary);
}

.new-badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

/* ---------- 重要度・添付ファイル ---------- */
.priority-field select {
  width: auto;
  min-width: 200px;
}

.priority-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.priority-badge.priority-important {
  background: var(--warn-soft);
  color: var(--warn);
}

.priority-badge.priority-urgent {
  background: var(--danger);
  color: #fff;
}

.manual-card.card-important {
  border-left: 4px solid #e8a33a;
}

.manual-card.card-urgent {
  border-left: 4px solid var(--danger);
}

.feed-item.priority-important {
  border-left-color: #e8a33a;
  background: linear-gradient(180deg, var(--warn-soft), var(--surface) 90px);
}

.feed-item.priority-urgent {
  border-left-color: var(--danger);
  background: linear-gradient(180deg, var(--danger-soft), var(--surface) 90px);
}

.pinned-box {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 2px solid #e8a33a;
  border-radius: calc(var(--radius) + 4px);
  background: var(--warn-soft);
}

.pinned-box.has-urgent {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.pinned-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 1rem;
  color: var(--warn);
}

.pinned-box.has-urgent .pinned-title {
  color: var(--danger);
}

.pinned-title::before {
  content: "📌";
}

.pinned-title small {
  font-size: 0.74rem;
  opacity: 0.8;
}

.attach-field {
  display: grid;
  gap: 6px;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 5px 6px 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.84rem;
}

.attachment-name {
  overflow: hidden;
  max-width: 220px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.attachment-chip button {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--muted);
  cursor: pointer;
}

.attachment-chip button:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.notice-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.notice-images a {
  display: block;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
}

.notice-images img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s;
}

.notice-images a:hover img {
  transform: scale(1.03);
}

.notice-images a:only-child {
  aspect-ratio: auto;
  grid-column: 1 / -1;
}

.notice-images a:only-child img {
  height: auto;
  max-height: 420px;
  object-fit: contain;
}

.notice-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--primary);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.file-chip:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

/* ---------- 日本語も表示 ---------- */
.user-bar {
  flex-wrap: wrap;
}

.user-bar .lang-select-label {
  flex: 1 1 100%;
}

.user-bar .both-toggle {
  flex: 1 1 100%;
}

.both-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.9rem;
  cursor: pointer;
}

.both-toggle input {
  margin-top: 0;
}

.both-toggle span {
  display: grid;
  line-height: 1.3;
}

.both-toggle small {
  font-size: 0.72rem;
}

.both-toggle:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.original-ja {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  font-size: 0.9rem;
}

.original-ja strong {
  color: var(--text);
}

.original-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--primary);
}

/* ---------- 追加・更新した管理者(管理者画面のみ) ---------- */
.author-line {
  margin: 0 0 10px !important;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--muted) !important;
  font-size: 0.78rem !important;
  line-height: 1.6;
}

/* ---------- 日付で探す ---------- */
.feed-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.feed-date-search {
  flex: 1 1 260px;
  gap: 8px;
  font-size: 0.88rem;
}

.feed-date-search small,
#feed-show-all small {
  color: inherit;
  font-size: 0.74rem;
  opacity: 0.8;
}

.date-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.date-nav input[type="date"] {
  flex: 1;
  min-width: 0;
  font-size: 1rem;
  font-weight: 600;
}

.date-nav .small-btn {
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
}

/* ---------- 掲示用チラシ・AI下書き ---------- */
.flyer-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--line));
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary-soft), var(--surface) 70%);
}

.flyer-card h4,
.flyer-card p {
  margin: 0;
}

.flyer-options {
  display: grid;
  gap: 12px;
  font-size: 0.9rem;
}

.flyer-options select {
  width: auto;
}

.flyer-lang {
  cursor: pointer;
}

.flyer-lang input {
  margin: 0;
}

.flyer-lang:has(input:checked) {
  background: var(--primary);
  color: #fff;
}

.flyer-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.flyer-check input {
  margin: 0;
}

#flyer-result {
  display: grid;
  gap: 12px;
}

.ai-draft {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px dashed color-mix(in srgb, var(--primary) 45%, var(--line));
  border-radius: var(--radius);
  background: var(--primary-soft);
  font-size: 0.92rem;
}

.ai-draft-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-draft-row input {
  flex: 1;
  min-width: 200px;
  background: var(--surface);
}

/* ---------- 会社ロゴ ---------- */
.brand.has-logo::before {
  display: none;
}

.brand-logo {
  display: block;
  height: 40px;
  width: auto;
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
}

.brand-logo-sub {
  height: 28px;
  padding: 3px 6px;
  background: #ffffff;
}

@media (max-width: 480px) {
  .brand.has-logo > span:last-child {
    font-size: 0.88rem;
  }

  .brand-beisia {
    height: 20px;
  }

  .brand-company {
    font-size: 0.68rem;
  }

  .brand-logo-sub {
    height: 24px;
  }

  .brand-logo {
    height: 34px;
  }
}

/* ---------- バナー ---------- */
.app-banner {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- ベイシア + うんまいファクトリー(文字) ---------- */
.brand-stack {
  display: grid;
  justify-items: center;
  gap: 1px;
  padding: 4px 10px 5px;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.brand-beisia {
  display: block;
  height: 24px;
  width: auto;
}

.brand-company {
  font-family: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  font-weight: 800;
  font-size: 0.78rem;
  line-height: 1.05;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: #e60012;
}

.brand-company .o {
  color: #f39800;
}

/* ---------- レスポンシブ ---------- */
@media (max-width: 1020px) {
  .notice-layout {
    grid-template-columns: 1fr;
  }

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

  .viewer-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 14px;
  }

  .hero {
    flex-direction: column;
    align-items: stretch;
    padding: 22px 20px;
  }

  .stats {
    width: 100%;
  }

  .stat {
    flex: 1;
  }

  .panel {
    padding: 16px;
  }

  .viewer-header,
  .qr-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-links a {
    padding: 6px 10px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .top-nav,
  .user-bar,
  .back-btn,
  .pdf-actions,
  .card-actions,
  .language-switcher {
    display: none !important;
  }

  .panel,
  .hero {
    box-shadow: none;
  }
}
