:root {
  --primary: #2c5282;
  --primary-light: #3182ce;
  --primary-dark: #1a365d;
  --sidebar-width: 250px;
  --sidebar-bg: #1a202c;
  --sidebar-text: #e2e8f0;
  --sidebar-hover: #2d3748;
  --sidebar-active: #2c5282;
}

body {
  font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
  background: #f7fafc;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  overflow-y: auto;
  z-index: 1000;
  transition: transform 0.3s;
}

.sidebar-header {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid #2d3748;
  font-weight: 700;
  font-size: 1.1rem;
}

.sidebar-nav .nav-section {
  padding: 0.5rem 1rem 0.25rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  color: #718096;
  letter-spacing: 0.05em;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.875rem;
  transition: background 0.2s;
}

.sidebar-nav a:hover {
  background: var(--sidebar-hover);
}

.sidebar-nav a.active {
  background: var(--sidebar-active);
  border-left: 3px solid #63b3ed;
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  padding: 1.5rem 2rem;
  min-height: 100vh;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.top-bar h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a202c;
  margin: 0;
}

/* Cards */
.stat-card {
  border: none;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.stat-card .card-body {
  padding: 1.25rem;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 0.8rem;
  color: #718096;
}

/* Auth Pages */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a365d 0%, #2c5282 100%);
}

.auth-card {
  background: white;
  border-radius: 1rem;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.auth-card h2 {
  color: var(--primary-dark);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.auth-card .subtitle {
  color: #718096;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* Tables */
.table-modern {
  border-collapse: separate;
  border-spacing: 0;
}

.table-modern thead th {
  background: #edf2f7;
  border: none;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: #4a5568;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
}

.table-modern tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #edf2f7;
  vertical-align: middle;
}

.table-modern tbody tr:hover {
  background: #f7fafc;
}

/* Status Badges */
.badge-active { background: #48bb78; }
.badge-leave { background: #ed8936; }
.badge-withdrawn { background: #a0aec0; }
.badge-requested { background: #4299e1; }
.badge-scheduled { background: #9f7aea; }
.badge-in_progress { background: #ed8936; }
.badge-settled { background: #48bb78; }
.badge-unresolved { background: #fc8181; }
.badge-open { background: #4299e1; }
.badge-filed { background: #ed8936; }
.badge-investigating { background: #9f7aea; }
.badge-resolved { background: #48bb78; }
.badge-dismissed { background: #a0aec0; }
.badge-completed { background: #48bb78; }
.badge-approved { background: #48bb78; }
.badge-rejected { background: #fc8181; }

/* Chat */
.chat-container {
  height: calc(100vh - 250px);
  display: flex;
  flex-direction: column;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: #f7fafc;
  border-radius: 0.5rem;
  border: 1px solid #e2e8f0;
}

.chat-message {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  max-width: 80%;
}

.chat-message.user {
  background: var(--primary);
  color: white;
  margin-left: auto;
}

.chat-message.assistant {
  background: white;
  border: 1px solid #e2e8f0;
}

.chat-message.system {
  background: #f0f9ff;
  border: 1px dashed #bee3f8;
  max-width: 100%;
  text-align: center;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

.chat-input-area {
  display: flex;
  gap: 0.5rem;
  padding-top: 1rem;
}

.chat-input-area textarea {
  flex: 1;
  resize: none;
  border-radius: 0.5rem;
}

/* Print */
@media print {
  .sidebar, .top-bar, .btn, .no-print { display: none !important; }
  .main-content { margin-left: 0; padding: 0; }
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.show {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .chat-message {
    max-width: 95%;
  }
}

/* Document list */
.doc-list-item {
  border-left: 3px solid transparent;
  transition: all 0.2s;
}
.doc-list-item:hover {
  border-left-color: var(--primary-light);
  background: #f7fafc;
}
.doc-list-item.active {
  border-left-color: var(--primary);
  background: #ebf4ff !important;
  color: #1a202c !important;
}
.doc-list-item.active small { color: #4a5568 !important; }

/* Checklist description */
.checklist-description {
  border-left: 2px solid #e2e8f0;
  padding-left: 0.5rem;
}
.checklist-item {
  transition: all 0.2s;
}

/* Revision active row */
.table-active {
  background: #ebf4ff !important;
}

/* Content editor */
.content-editor {
  font-family: 'Hiragino Mincho ProN', 'Yu Mincho', monospace;
  font-size: 0.9rem;
  line-height: 1.8;
  white-space: pre-wrap;
  tab-size: 4;
  resize: vertical;
}

/* Preformatted text (templates) */
.template-preview {
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 1.5rem;
  white-space: pre-wrap;
  font-family: 'Hiragino Mincho ProN', 'Yu Mincho', serif;
  font-size: 0.9rem;
  line-height: 1.8;
}
