:root {
  --fi-navy: #1a2744;
  --fi-navy-dark: #111a30;
  --fi-gold: #c8a96e;
  --fi-off-white: #f8f7f4;
  --fi-main-bg: #f0ede8;
  --fi-drop-bg: #e8e4de;
  --fi-text: #333;
  --fi-text-light: #888;
  --fi-border: #d5d0c8;
  --fi-danger: #c0392b;
  --fi-warning: #e6a817;
  --fi-success: #27ae60;
  --fi-white: #fff;
}

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

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--fi-main-bg);
  color: var(--fi-text);
  height: 100vh;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.6;
}

h1, h2, h3 {
  font-family: 'Cormorant Garamond', serif;
}

.app {
  display: flex;
  height: 100vh;
}

/* ============ SIDEBAR ============ */
.sidebar {
  width: 230px;
  min-width: 230px;
  background: var(--fi-navy-dark);
  color: var(--fi-off-white);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.sidebar-logo h1 {
  font-size: 22px;
  color: var(--fi-gold);
  letter-spacing: 2px;
}

.sidebar-logo .subtitle {
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  margin-top: 2px;
  font-family: 'Noto Sans JP', sans-serif;
}

.doc-status {
  padding: 16px 12px;
  flex-shrink: 0;
}

.doc-status h3 {
  font-size: 11px;
  color: var(--fi-gold);
  margin-bottom: 10px;
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 500;
  letter-spacing: 1px;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 4px;
  font-size: 12px;
  color: rgba(255,255,255,0.35);
  transition: color 0.3s;
}

.status-item.dim {
  color: rgba(255,255,255,0.55);
}

.status-item.lit {
  color: var(--fi-gold);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}

.status-item.dim .status-dot {
  background: rgba(200,169,110,0.45);
}

.status-item.lit .status-dot {
  background: var(--fi-gold);
  box-shadow: 0 0 6px rgba(200,169,110,0.5);
}

/* File list */
.file-list-section {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 8px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.file-list-section h3 {
  font-size: 11px;
  color: var(--fi-gold);
  padding: 10px 0 6px;
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 500;
  position: sticky;
  top: 0;
  background: var(--fi-navy-dark);
}

.file-entry {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  border-radius: 4px;
}

.file-entry:hover {
  background: rgba(255,255,255,0.05);
}

.file-entry .file-icon {
  flex-shrink: 0;
  font-size: 13px;
}

.file-entry .file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-entry .file-delete {
  flex-shrink: 0;
  background: none;
  border: none;
  color: rgba(255,255,255,0.3);
  cursor: pointer;
  font-size: 14px;
  padding: 0 2px;
  line-height: 1;
}

.file-entry .file-delete:hover {
  color: var(--fi-danger);
}

/* Sidebar footer */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.sekou-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 8px;
}

.toggle-switch {
  position: relative;
  width: 36px;
  height: 18px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.15);
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.3s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 2px;
  top: 2px;
  background: var(--fi-off-white);
  border-radius: 50%;
  transition: transform 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--fi-gold);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

.settings-btn {
  display: block;
  width: 100%;
  padding: 6px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  color: rgba(255,255,255,0.6);
  font-size: 11px;
  cursor: pointer;
  transition: background 0.2s;
}

.settings-btn:hover {
  background: rgba(255,255,255,0.1);
}

/* ============ MAIN AREA ============ */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.header {
  background: var(--fi-off-white);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--fi-border);
  flex-shrink: 0;
}

.header-title {
  font-size: 16px;
  color: var(--fi-navy);
  font-weight: 500;
}

.header-info {
  font-size: 11px;
  color: var(--fi-text-light);
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

/* ============ SCREEN 1 ============ */
.company-banner {
  background: var(--fi-navy);
  color: var(--fi-off-white);
  padding: 14px 20px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 15px;
  display: none;
  align-items: center;
  gap: 10px;
}

.company-banner.visible {
  display: flex;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: var(--fi-gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.drop-zone {
  border: 2px dashed var(--fi-border);
  border-radius: 8px;
  padding: 48px 20px;
  text-align: center;
  background: var(--fi-drop-bg);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 16px;
}

.drop-zone.dragover {
  border-color: var(--fi-gold);
  background: rgba(200,169,110,0.08);
}

.drop-zone-icon {
  font-size: 36px;
  margin-bottom: 10px;
  color: var(--fi-text-light);
}

.drop-zone-text {
  font-size: 14px;
  color: var(--fi-text-light);
}

.drop-zone-sub {
  font-size: 11px;
  color: #aaa;
  margin-top: 4px;
}

.separator {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--fi-text-light);
  font-size: 12px;
}

.separator::before,
.separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--fi-border);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-family: 'Noto Sans JP', sans-serif;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-outline {
  background: var(--fi-white);
  border: 1px solid var(--fi-border);
  color: var(--fi-text);
}

.btn-outline:hover:not(:disabled) {
  background: var(--fi-drop-bg);
}

.btn-primary {
  background: var(--fi-navy);
  color: var(--fi-off-white);
}

.btn-primary:hover:not(:disabled) {
  background: #253559;
}

.btn-gold {
  background: var(--fi-gold);
  color: var(--fi-navy);
  font-weight: 500;
}

.btn-gold:hover:not(:disabled) {
  background: #b89a5f;
}

.file-select-row {
  margin-bottom: 16px;
}

/* Explorer */
.explorer-section {
  margin-top: 8px;
  margin-bottom: 20px;
}

.explorer-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--fi-white);
  border: 1px solid var(--fi-border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--fi-text);
  cursor: pointer;
  font-family: 'Noto Sans JP', sans-serif;
}

.explorer-toggle:hover {
  background: var(--fi-drop-bg);
}

.explorer-panel {
  display: none;
  margin-top: 10px;
  background: var(--fi-drop-bg);
  border: 1px solid var(--fi-border);
  border-radius: 6px;
  padding: 12px;
  max-height: 250px;
  overflow-y: auto;
}

.explorer-panel.open {
  display: block;
}

.explorer-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  font-size: 12px;
  border-radius: 4px;
  cursor: pointer;
}

.explorer-file:hover {
  background: rgba(0,0,0,0.04);
}

.explorer-file input[type="checkbox"] {
  accent-color: var(--fi-gold);
}

.explorer-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

/* Missing docs alert */
.missing-alert {
  background: #fef9e7;
  border: 1px solid var(--fi-warning);
  border-radius: 6px;
  padding: 14px 16px;
  margin: 16px 0;
}

.missing-alert h4 {
  font-size: 13px;
  color: #8a6d00;
  margin-bottom: 6px;
  font-family: 'Noto Sans JP', sans-serif;
}

.missing-alert ul {
  list-style: none;
  font-size: 12px;
  color: #8a6d00;
}

.missing-alert ul li::before {
  content: '・';
}

.missing-alert .missing-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

/* No reshitauke alert */
.no-reshitauke-alert {
  background: #fdedec;
  border: 1px solid var(--fi-danger);
  border-radius: 6px;
  padding: 14px 16px;
  margin: 16px 0;
}

.no-reshitauke-alert h4 {
  font-size: 13px;
  color: var(--fi-danger);
  margin-bottom: 6px;
  font-family: 'Noto Sans JP', sans-serif;
}

.no-reshitauke-alert .alert-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

/* Warnings */
.warnings-box {
  background: #fdf2e9;
  border: 1px solid #e67e22;
  border-radius: 6px;
  padding: 14px 16px;
  margin: 16px 0;
  font-size: 12px;
  color: #8a5000;
}

/* File limit */
.file-limit-alert {
  background: var(--fi-navy);
  color: var(--fi-off-white);
  border-radius: 6px;
  padding: 20px;
  text-align: center;
  margin: 16px 0;
}

.file-limit-alert a {
  color: var(--fi-gold);
  text-decoration: underline;
}

/* Judge button */
.judge-section {
  margin-top: 20px;
  text-align: center;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.loading-box {
  background: var(--fi-white);
  border-radius: 10px;
  padding: 32px 48px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.loading-box .spinner {
  width: 32px;
  height: 32px;
  border-width: 3px;
  border-color: var(--fi-border);
  border-top-color: var(--fi-navy);
  margin: 0 auto 12px;
}

.loading-box p {
  font-size: 14px;
  color: var(--fi-text);
}

/* ============ SCREEN 2 ============ */
.result-summary {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.summary-card {
  flex: 1;
  min-width: 140px;
  background: var(--fi-white);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  border: 1px solid var(--fi-border);
}

.summary-card .count {
  font-size: 28px;
  font-weight: 700;
}

.summary-card .label {
  font-size: 12px;
  color: var(--fi-text-light);
  margin-top: 4px;
}

.summary-card.violation .count { color: var(--fi-danger); }
.summary-card.caution .count { color: var(--fi-warning); }
.summary-card.pass .count { color: var(--fi-success); }

.result-items {
  margin-bottom: 24px;
}

.result-item {
  background: var(--fi-white);
  border-radius: 6px;
  border: 1px solid var(--fi-border);
  margin-bottom: 8px;
  overflow: hidden;
}

.result-item-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
}

.result-item-header:hover {
  background: rgba(0,0,0,0.02);
}

.result-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.result-title {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
}

.result-detail-text {
  font-size: 12px;
  color: var(--fi-text-light);
  flex: 2;
}

.result-expand {
  flex-shrink: 0;
  color: var(--fi-text-light);
  font-size: 16px;
  transition: transform 0.2s;
}

.result-item.open .result-expand {
  transform: rotate(90deg);
}

.result-detail {
  display: none;
  padding: 0 16px 14px;
  font-size: 12px;
  border-top: 1px solid var(--fi-border);
}

.result-item.open .result-detail {
  display: block;
  padding-top: 12px;
}

.detail-section {
  margin-bottom: 8px;
}

.detail-label {
  font-weight: 500;
  color: var(--fi-navy);
  margin-bottom: 2px;
}

.detail-value {
  color: var(--fi-text);
  line-height: 1.5;
}

/* Email area */
.email-area {
  background: var(--fi-white);
  border: 1px solid var(--fi-border);
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 20px;
}

.email-area h3 {
  font-size: 14px;
  color: var(--fi-navy);
  margin-bottom: 12px;
  font-family: 'Noto Sans JP', sans-serif;
}

.email-content {
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.7;
  color: var(--fi-text);
  background: var(--fi-main-bg);
  padding: 16px;
  border-radius: 4px;
  max-height: 400px;
  overflow-y: auto;
}

.result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 12px 0;
}

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal {
  background: var(--fi-white);
  border-radius: 10px;
  padding: 28px;
  width: 480px;
  max-width: 90vw;
  position: relative;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--fi-text-light);
  cursor: pointer;
}

.modal-close:hover {
  color: var(--fi-text);
}

.modal h2 {
  font-size: 16px;
  color: var(--fi-navy);
  margin-bottom: 20px;
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 500;
}

.column-choices {
  display: flex;
  gap: 14px;
  margin-bottom: 24px;
}

.column-choice {
  flex: 1;
  padding: 16px;
  border: 2px solid var(--fi-border);
  border-radius: 8px;
  background: var(--fi-white);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
}

.column-choice:hover {
  border-color: var(--fi-gold);
}

.column-choice.selected {
  border-color: var(--fi-gold);
  background: rgba(200,169,110,0.08);
}

.column-choice .check {
  font-size: 18px;
  margin-bottom: 6px;
}

.column-choice .col-label {
  font-size: 12px;
  color: var(--fi-text-light);
  margin-bottom: 4px;
}

.column-choice .col-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--fi-navy);
}

.modal-confirm {
  display: block;
  width: 100%;
}

/* ============ SETTINGS ============ */
.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.settings-panel {
  background: var(--fi-white);
  border-radius: 10px;
  padding: 24px;
  width: 420px;
  max-width: 90vw;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.settings-panel h2 {
  font-size: 16px;
  color: var(--fi-navy);
  margin-bottom: 16px;
  font-family: 'Noto Sans JP', sans-serif;
}

.setting-item {
  margin-bottom: 14px;
}

.setting-item label {
  display: block;
  font-size: 12px;
  color: var(--fi-text-light);
  margin-bottom: 4px;
}

.setting-item input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--fi-border);
  border-radius: 4px;
  font-size: 13px;
  font-family: 'Noto Sans JP', sans-serif;
}

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

/* Classified file list in main area */
.classified-list {
  margin: 16px 0;
}

.classified-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--fi-white);
  border: 1px solid var(--fi-border);
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 13px;
}

.classified-item .cl-status {
  flex-shrink: 0;
  font-size: 14px;
}

.classified-item .cl-name {
  flex: 1;
  font-weight: 500;
}

.classified-item .cl-type {
  color: var(--fi-text-light);
  font-size: 12px;
}

.classified-item .cl-note {
  font-size: 11px;
  color: var(--fi-warning);
}

.classified-item .cl-delete {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--fi-text-light);
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
}

.classified-item .cl-delete:hover {
  color: var(--fi-danger);
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--fi-navy);
  color: var(--fi-off-white);
  padding: 12px 20px;
  border-radius: 6px;
  font-size: 13px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  z-index: 300;
  animation: toast-in 0.3s ease;
}

@keyframes toast-in {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Raw text fallback */
.raw-text {
  background: var(--fi-drop-bg);
  border: 1px solid var(--fi-border);
  border-radius: 6px;
  padding: 16px;
  white-space: pre-wrap;
  font-size: 12px;
  max-height: 400px;
  overflow-y: auto;
  margin: 16px 0;
}
