/* ==============================================
   SEED Billing System - Main Stylesheet
   ============================================== */

:root {
  --color-bg: #f5f4f0;
  --color-surface: #ffffff;
  --color-surface-2: #faf9f5;
  --color-border: #e5e2da;
  --color-border-strong: #d4d0c4;

  --color-text: #1f1c18;
  --color-text-sub: #6b665d;
  --color-text-muted: #9a948a;

  --color-primary: #3d342a;       /* SEED系 深いブラウン */
  --color-primary-hover: #514538;
  --color-accent: #8a6d3b;        /* アンティークゴールド */
  --color-accent-light: #c9a96b;

  --color-success: #5b7c4f;
  --color-warning: #b8862f;
  --color-danger: #a64835;
  --color-info: #4a6b8a;

  --color-success-bg: #e8efe2;
  --color-warning-bg: #f5ecd6;
  --color-danger-bg: #f0dad3;
  --color-info-bg: #dde6ef;

  --shadow-sm: 0 1px 2px rgba(31, 28, 24, 0.04);
  --shadow-md: 0 4px 16px rgba(31, 28, 24, 0.06);
  --shadow-lg: 0 12px 40px rgba(31, 28, 24, 0.12);

  --radius: 6px;
  --radius-lg: 10px;

  --font-jp: 'Noto Sans JP', sans-serif;
  --font-en: 'Inter', sans-serif;

  --sidebar-w: 240px;
  --topbar-h: 64px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  font-family: var(--font-jp);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; width: 100%; }

/* ---------- App Layout ---------- */
.app {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--color-primary);
  color: #d8d2c4;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 50;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 22px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  background: var(--color-accent);
  color: #fff;
  font-family: var(--font-en);
  font-weight: 700;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
}

.brand-name {
  font-family: var(--font-en);
  font-weight: 600;
  font-size: 15px;
  color: #fff;
  letter-spacing: 0.04em;
}

.brand-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 2px;
}

.sidebar-close {
  display: none;
  color: #fff;
  font-size: 24px;
  line-height: 1;
  padding: 4px 8px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section {
  font-family: var(--font-en);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.4);
  margin: 16px 12px 8px;
}

.nav-section:first-child { margin-top: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: rgba(255, 255, 255, 0.75);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-item.active {
  background: rgba(201, 169, 107, 0.18);
  color: #fff;
}

.nav-icon {
  width: 22px;
  font-family: var(--font-en);
  font-size: 14px;
  text-align: center;
  color: var(--color-accent-light);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-version {
  font-family: var(--font-en);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
}

.footer-company {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 2px;
}

/* ---------- Main ---------- */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.menu-btn {
  display: none;
  font-size: 24px;
  color: var(--color-text);
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
}

.page-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.04em;
  flex: 1;
}

.topbar-right {
  display: flex;
  gap: 8px;
}

.view-container {
  padding: 28px;
  flex: 1;
  min-width: 0;
}

.view { display: none; }
.view.active { display: block; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius);
  transition: all 0.15s ease;
  white-space: nowrap;
  border: 1px solid transparent;
  letter-spacing: 0.02em;
}

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

.btn-ghost {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn-ghost:hover {
  background: var(--color-surface-2);
  border-color: var(--color-border-strong);
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
}

.btn-icon {
  padding: 6px 8px;
  font-size: 13px;
  background: transparent;
  color: var(--color-text-sub);
  border-radius: var(--radius);
  transition: background 0.15s ease, color 0.15s ease;
}
.btn-icon:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

/* ---------- Stats ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--color-surface);
  padding: 22px 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 12px;
  color: var(--color-text-sub);
  margin-bottom: 8px;
  letter-spacing: 0.04em;
}

.stat-value {
  font-family: var(--font-en);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-text);
}

.stat-meta {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-danger { color: var(--color-danger); }
.text-info { color: var(--color-info); }
.text-right { text-align: right; }

/* ---------- Card ---------- */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.card-desc {
  padding: 0 24px;
  font-size: 12.5px;
  color: var(--color-text-sub);
  margin: -8px 0 16px;
}

.card > .card-title {
  padding: 18px 24px 0;
}

.card > .form-grid,
.card > .tax-list,
.card > .template-grid {
  padding: 16px 24px 24px;
}

.card > .form-grid + button,
.card .tax-list + button {
  margin: 0 24px 24px;
}

.card-link {
  font-size: 12.5px;
  color: var(--color-accent);
  font-weight: 500;
}
.card-link:hover { text-decoration: underline; }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  max-width: 360px;
  padding: 9px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--color-surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(138, 109, 59, 0.08);
}

.filter-select {
  padding: 9px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--color-surface);
  cursor: pointer;
}

.toolbar .btn-primary { margin-left: auto; }

/* ---------- Table ---------- */
.table-wrap {
  overflow-x: auto;
}

.data-table {
  font-size: 13px;
}

.data-table thead th {
  background: var(--color-surface-2);
  padding: 12px 18px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--color-text-sub);
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover {
  background: var(--color-surface-2);
}

.data-table .empty {
  text-align: center;
  padding: 48px;
  color: var(--color-text-muted);
  font-size: 13px;
}

.data-table .doc-num {
  font-family: var(--font-en);
  font-weight: 500;
  color: var(--color-text);
}

.data-table .amount {
  font-family: var(--font-en);
  font-weight: 600;
}

/* ---------- Status Badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 12px;
  letter-spacing: 0.04em;
}

.badge-draft { background: #ebe8e0; color: #6b665d; }
.badge-sent { background: var(--color-info-bg); color: var(--color-info); }
.badge-unpaid { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-paid { background: var(--color-success-bg); color: var(--color-success); }
.badge-overdue { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-accepted { background: var(--color-success-bg); color: var(--color-success); }
.badge-issued { background: var(--color-info-bg); color: var(--color-info); }

.row-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

/* ---------- Form ---------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group-full { grid-column: 1 / -1; }

.form-group-flex { flex: 1; }

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-sub);
  letter-spacing: 0.04em;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 13.5px;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(138, 109, 59, 0.08);
}

.form-group input[readonly] {
  background: var(--color-surface-2);
  color: var(--color-text-sub);
}

.form-group textarea { resize: vertical; min-height: 60px; }

.form-help {
  font-size: 11.5px;
  color: var(--color-text-muted);
  margin-top: 4px;
  padding: 0 24px 24px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.input-with-btn {
  display: flex;
  gap: 6px;
}

.input-with-btn input { flex: 1; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

/* ---------- Tax Settings ---------- */
.tax-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.tax-row {
  display: grid;
  grid-template-columns: 1fr 120px 120px 40px;
  gap: 10px;
  align-items: center;
}

.tax-row input,
.tax-row select {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--color-surface);
}

.tax-row .btn-icon { color: var(--color-danger); }

/* ---------- Template ---------- */
.template-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.template-card {
  cursor: pointer;
  text-align: center;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.template-card:hover { background: var(--color-surface-2); }

.template-card input { display: none; }

.template-card:has(input:checked) {
  border-color: var(--color-accent);
  background: var(--color-surface-2);
}

.template-preview {
  height: 140px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tp-line {
  height: 14px;
  background: var(--color-text);
  width: 50%;
  border-radius: 2px;
}

.template-modern .tp-line {
  background: var(--color-accent);
}

.template-classic .tp-line {
  background: var(--color-text);
  position: relative;
}
.template-classic .tp-line::after {
  content: '';
  position: absolute;
  left: 0; bottom: -3px;
  width: 100%;
  height: 1px;
  background: var(--color-text);
}

.tp-line-thick { height: 18px; }

.tp-block {
  height: 22px;
  background: #f0ede5;
  border-radius: 2px;
  width: 70%;
}

.tp-rows {
  flex: 1;
  background: repeating-linear-gradient(
    180deg,
    transparent 0,
    transparent 4px,
    #ebe8e0 4px,
    #ebe8e0 5px,
    transparent 5px,
    transparent 12px
  );
  border-radius: 2px;
}

.template-name {
  font-family: var(--font-en);
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.template-desc {
  font-size: 11.5px;
  color: var(--color-text-sub);
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 28, 24, 0.5);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 1000;
  padding: 40px 20px;
  overflow-y: auto;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.modal-overlay.is-open {
  display: flex;
}

.modal-dialog {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  margin: auto;
  max-height: calc(100vh - 80px);
}

.modal-xl { max-width: 920px; }

.modal-preview {
  max-width: 920px;
}

.modal-head {
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.modal-head h2 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close-btn {
  width: 32px;
  height: 32px;
  font-size: 22px;
  color: var(--color-text-sub);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.modal-close-btn:hover {
  background: var(--color-surface-2);
}

.modal-body {
  padding: 22px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-foot {
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

.modal-foot .foot-right {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.preview-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.preview-body {
  background: #ebe8e0;
  padding: 24px;
}

/* ---------- Document Form (内訳明細) ---------- */
.section-subtitle {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin: 20px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--color-border);
  letter-spacing: 0.04em;
}

.line-items-wrap {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 10px;
}

.line-items {
  font-size: 12.5px;
  min-width: 720px;
}

.line-items thead th {
  background: var(--color-surface-2);
  padding: 9px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-sub);
  text-align: left;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--color-border);
}

.line-items tbody td {
  padding: 6px;
  border-bottom: 1px solid var(--color-border);
}

.line-items tbody tr:last-child td { border-bottom: none; }

.line-items input,
.line-items select {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 12.5px;
  background: transparent;
  color: var(--color-text);
}

.line-items input:focus,
.line-items select:focus {
  outline: none;
  border-color: var(--color-accent);
  background: var(--color-surface);
}

.line-items input[type="number"] { text-align: right; }

.line-subtotal {
  text-align: right;
  font-family: var(--font-en);
  font-weight: 500;
  padding-right: 12px !important;
}

.line-remove {
  text-align: center;
  color: var(--color-danger);
  font-size: 18px;
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 4px;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  transition: background 0.15s ease;
}
.line-remove:hover { background: var(--color-danger-bg); }

.line-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

/* ---------- Totals ---------- */
.totals-area {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
}

.totals-box {
  width: 320px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 18px;
  background: var(--color-surface-2);
}

.totals-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
  color: var(--color-text);
}

.totals-row span:last-child {
  font-family: var(--font-en);
  font-weight: 500;
}

.tax-line {
  font-size: 12px;
  color: var(--color-text-sub);
}

.total-final {
  border-top: 1px solid var(--color-border-strong);
  margin-top: 6px;
  padding-top: 10px;
  font-weight: 600;
  font-size: 15px;
}

.total-final span:last-child {
  font-size: 17px;
  color: var(--color-primary);
}

/* ---------- Select List Modal ---------- */
.select-list {
  margin-top: 14px;
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.select-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background 0.15s ease;
}

.select-item:last-child { border-bottom: none; }
.select-item:hover { background: var(--color-surface-2); }

.select-item-name {
  font-weight: 500;
  margin-bottom: 2px;
}

.select-item-meta {
  font-size: 11.5px;
  color: var(--color-text-sub);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--color-primary);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 2000;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Print Area ---------- */
.print-only {
  display: none;
}

/* ---------- User Menu (トップバー) ---------- */
.user-menu {
  position: relative;
  margin-left: 8px;
}

.user-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.user-trigger:hover {
  background: var(--color-surface-2);
  border-color: var(--color-border-strong);
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-family: var(--font-en);
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
  min-width: 0;
}

.user-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.user-role {
  font-size: 10.5px;
  color: var(--color-text-sub);
  margin-top: 1px;
  letter-spacing: 0.04em;
}

.user-caret {
  font-size: 10px;
  color: var(--color-text-sub);
  margin-left: 2px;
  transition: transform 0.2s ease;
}

.user-menu.is-open .user-caret {
  transform: rotate(180deg);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.18s ease, visibility 0.18s ease, transform 0.18s ease;
  z-index: 100;
}

.user-menu.is-open .user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-header {
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 6px;
}

.dropdown-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}

.dropdown-email {
  font-size: 11.5px;
  color: var(--color-text-sub);
  margin-top: 2px;
  word-break: break-all;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.dropdown-item:hover {
  background: var(--color-surface-2);
}

.dropdown-item span:first-child {
  font-size: 14px;
  width: 18px;
  text-align: center;
}

.dropdown-divider {
  height: 1px;
  background: var(--color-border);
  margin: 6px 4px;
}

.dropdown-logout {
  color: var(--color-danger);
}

.dropdown-logout:hover {
  background: var(--color-danger-bg);
}

/* ---------- 権限なし要素は非表示 ---------- */
[data-permission] { display: none; }
[data-permission].is-permitted { display: flex; }
.nav-item[data-permission].is-permitted { display: flex; }
.dropdown-item[data-permission].is-permitted { display: flex; }
button[data-permission].is-permitted { display: inline-flex; }

/* ---------- Role Badge ---------- */
.role-badge {
  display: inline-block;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 12px;
  letter-spacing: 0.04em;
}

.role-badge-admin { background: #f0dad3; color: #a64835; }
.role-badge-accounting { background: #dde6ef; color: #4a6b8a; }
.role-badge-sales { background: #e8efe2; color: #5b7c4f; }

.status-active {
  color: var(--color-success);
  font-size: 12px;
  font-weight: 500;
}
.status-inactive {
  color: var(--color-text-muted);
  font-size: 12px;
}

.role-info {
  padding: 8px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.role-info-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  font-size: 13px;
  color: var(--color-text-sub);
  line-height: 1.7;
}

.role-tag {
  flex-shrink: 0;
  display: inline-block;
  padding: 3px 12px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 12px;
  min-width: 64px;
  text-align: center;
}

.form-hint {
  font-size: 11.5px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.modal-sm { max-width: 440px; }

/* ---------- Mobile: ユーザーメニュー縮小 ---------- */
@media (max-width: 768px) {
  .user-info { display: none; }
  .user-trigger {
    padding: 4px 6px;
    gap: 4px;
  }
  .topbar-right .btn-ghost { padding: 7px 12px; font-size: 12px; }
  .role-info-item {
    flex-direction: column;
    gap: 4px;
  }
}
