/* G-Commander R04 Design System & R06 Manager Web Styling */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700&display=swap');

:root {
  /* Brand Core Colors */
  --brand-gold: #FECA04;
  --brand-gold-hover: #E5B603;
  --brand-gold-active: #CA9E02;
  --brand-gold-subtle: rgba(254, 202, 4, 0.12);
  --brand-gold-glow: rgba(254, 202, 4, 0.25);
  --brand-black: #000000;
  --accent-gold: #FECA04;

  /* Surfaces & Backgrounds */
  --bg-primary: #0B0F17;
  --bg-canvas: #0B0F17;
  --bg-surface: #131926;
  --bg-surface-elevated: #1E2638;
  --bg-surface-hover: #263045;

  /* Radii */
  --radius-md: 8px;

  /* Borders & Rules */
  --border-subtle: #2B3548;
  --border-focus: #FECA04;
  --border-strong: #3E4C66;

  /* Typography */
  --text-primary: #F9FAFB;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --text-inverse: #000000;

  /* Semantic Status Colors */
  --status-success: #10B981;
  --status-success-hover: #059669;
  --status-success-subtle: rgba(16, 185, 129, 0.15);

  --status-warning: #F59E0B;
  --status-warning-hover: #D97706;
  --status-warning-subtle: rgba(245, 158, 11, 0.15);

  --status-danger: #EF4444;
  --status-danger-hover: #DC2626;
  --status-danger-subtle: rgba(239, 68, 68, 0.15);

  --status-info: #38BDF8;
  --status-info-hover: #0284C7;
  --status-info-subtle: rgba(56, 189, 248, 0.15);

  --status-purple: #8B5CF6;
  --status-purple-hover: #7C3AED;
  --status-purple-subtle: rgba(139, 92, 246, 0.15);

  /* Layout Dimensions */
  --sidebar-width: 216px;
  --header-height: 76px;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Noto Sans JP', sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* Sidebar (Left 216px) */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-primary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
}

.sidebar-logo {
  height: var(--header-height);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-logo img {
  height: 38px;
  width: auto;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
  cursor: pointer;
  user-select: none;
}

.nav-item:hover {
  background-color: var(--bg-surface);
  color: var(--text-primary);
}

.nav-item.active {
  background-color: var(--bg-surface);
  color: var(--brand-gold);
  border-left-color: var(--brand-gold);
}

.nav-item img {
  width: 18px;
  height: 18px;
  filter: brightness(0) saturate(100%) invert(80%);
}

.nav-item.active img {
  filter: invert(79%) sepia(85%) saturate(740%) hue-rotate(359deg) brightness(103%) contrast(105%);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-muted);
}

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

/* Top Header (76px) */
.header {
  height: var(--header-height);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background-color: var(--bg-primary);
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-title-area h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.header-badge {
  font-size: 12px;
  background-color: #1F1905;
  color: var(--brand-gold);
  border: 1px solid var(--brand-gold);
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 600;
}

/* Top Right User Area (Strict Flex Alignment) */
.header-user-area {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  white-space: nowrap;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  line-height: 1.2;
  margin: 0 4px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--brand-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-gold);
  font-weight: bold;
  font-size: 14px;
  flex-shrink: 0;
}

/* Button Standards & Hierarchy */
.btn,
.btn-primary,
.btn-secondary,
.btn-neutral,
.btn-ghost,
.btn-success,
.btn-danger,
.btn-danger-ghost,
.btn-warning,
.btn-warning-ghost,
.btn-info,
.btn-purple {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
  white-space: nowrap;
  height: 38px;
  padding: 0 16px;
  box-sizing: border-box;
  margin: 0;
  border: 1px solid transparent;
  user-select: none;
  vertical-align: middle;
}

.btn:active,
.btn-primary:active,
.btn-secondary:active,
.btn-neutral:active,
.btn-ghost:active,
.btn-success:active,
.btn-danger:active,
.btn-danger-ghost:active,
.btn-warning:active,
.btn-warning-ghost:active,
.btn-info:active,
.btn-purple:active {
  transform: scale(0.98);
}

.btn:disabled,
.btn[disabled],
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-neutral:disabled,
.btn-ghost:disabled,
.btn-success:disabled,
.btn-danger:disabled,
.btn-warning:disabled,
.btn-warning-ghost:disabled,
.btn-info:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none !important;
}

/* 1. Primary: Brand Command Yellow */
.btn-primary {
  background-color: var(--brand-gold);
  color: #000000;
  border-color: var(--brand-gold);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.btn-primary:hover {
  background-color: var(--brand-gold-hover);
  border-color: var(--brand-gold-hover);
  color: #000000;
}

/* 2. Secondary: Yellow Outline */
.btn-secondary {
  background-color: transparent;
  color: var(--brand-gold);
  border-color: var(--brand-gold);
}

.btn-secondary:hover {
  background-color: var(--brand-gold);
  color: #000000;
}

/* 3. Neutral / Ghost: Dark Surface Action */
.btn-neutral,
.btn-ghost {
  background-color: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.btn-neutral:hover,
.btn-ghost:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-strong);
  color: #FFFFFF;
}

/* 4. Success: Emerald Action (Confirm / Arrive / Lock) */
.btn-success {
  background-color: var(--status-success);
  color: #FFFFFF;
  border-color: var(--status-success);
  font-weight: 700;
}

.btn-success:hover {
  background-color: var(--status-success-hover);
  border-color: var(--status-success-hover);
  color: #FFFFFF;
}

/* 5. Danger: Crimson Action (Delete / Terminate) */
.btn-danger {
  background-color: var(--status-danger);
  color: #FFFFFF;
  border-color: var(--status-danger);
  font-weight: 700;
}

.btn-danger:hover {
  background-color: var(--status-danger-hover);
  border-color: var(--status-danger-hover);
  color: #FFFFFF;
}

.btn-danger-ghost {
  background-color: transparent;
  color: var(--status-danger);
  border-color: var(--status-danger);
}

.btn-danger-ghost:hover {
  background-color: var(--status-danger-subtle);
  color: #F87171;
}

/* 6. Warning: Amber Action (Caution / In-progress) */
.btn-warning {
  background-color: var(--status-warning);
  color: #000000;
  border-color: var(--status-warning);
  font-weight: 700;
}

.btn-warning:hover {
  background-color: var(--status-warning-hover);
  border-color: var(--status-warning-hover);
  color: #000000;
}

.btn-warning-ghost {
  background-color: transparent;
  color: var(--status-warning);
  border-color: var(--status-warning);
}

.btn-warning-ghost:hover {
  background-color: var(--status-warning-subtle);
  color: #FBBF24;
}

/* 7. Info: Sky Action */
.btn-info {
  background-color: #0284C7;
  color: #FFFFFF;
  border-color: #0284C7;
  font-weight: 600;
}

.btn-info:hover {
  background-color: #0369A1;
  border-color: #0369A1;
}

/* 8. Purple: SaaS Management Action */
.btn-purple {
  background-color: var(--status-purple);
  color: #FFFFFF;
  border-color: var(--status-purple);
  font-weight: 600;
}

.btn-purple:hover {
  background-color: var(--status-purple-hover);
  border-color: var(--status-purple-hover);
}

/* Active Filter Buttons & Badges */
.btn.active-filter,
.btn.review-filter-btn.active,
.btn-secondary.active-filter {
  background-color: var(--brand-gold) !important;
  color: #000000 !important;
  border-color: var(--brand-gold) !important;
  font-weight: 700 !important;
}

.btn.active-filter img,
.btn.review-filter-btn.active img,
.btn-secondary.active-filter img {
  filter: none !important;
}

.badge-secondary {
  background-color: rgba(148, 163, 184, 0.15);
  color: #CBD5E1;
  border: 1px solid #475569;
}

/* Button Sizes */
.btn-lg {
  height: 44px;
  padding: 0 20px;
  font-size: 14px;
  border-radius: 8px;
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 5px;
}

.btn-xs {
  height: 24px;
  padding: 0 8px;
  font-size: 11px;
  border-radius: 4px;
}

.btn-icon-only {
  width: 38px;
  padding: 0;
}

.btn-sm.btn-icon-only {
  width: 30px;
  padding: 0;
}

.btn-xs.btn-icon-only {
  width: 24px;
  padding: 0;
}

.btn-full {
  width: 100%;
  margin-top: 14px;
  height: 44px;
  font-size: 15px;
}

/* Page Content Body (Padding 24px) */
.content-body {
  padding: 24px;
  flex: 1;
}

/* Section Header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 18px;
  background-color: var(--brand-gold);
  border-radius: 2px;
}

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

.stat-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
  cursor: pointer;
  user-select: none;
  position: relative;
}

.stat-card:hover {
  border-color: var(--brand-gold);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.stat-card.selected {
  border-color: var(--brand-gold) !important;
  box-shadow: 0 0 0 2px rgba(254, 202, 4, 0.4), 0 4px 14px rgba(0, 0, 0, 0.3) !important;
  background: linear-gradient(180deg, rgba(254, 202, 4, 0.08) 0%, rgba(20, 24, 34, 1) 100%) !important;
}

.stat-card-hint {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-card.selected .stat-card-hint {
  color: var(--brand-gold);
  font-weight: 600;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 500;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.stat-unit {
  font-size: 14px;
  font-weight: normal;
  color: var(--text-muted);
}

.stat-card.alert {
  border-color: var(--border-subtle);
  background: var(--bg-surface);
}

.stat-card.alert:hover {
  border-color: var(--brand-gold);
}

.stat-card.alert.selected {
  border-color: var(--brand-gold) !important;
  background: linear-gradient(180deg, rgba(254, 202, 4, 0.08) 0%, rgba(20, 24, 34, 1) 100%) !important;
}

.stat-card.alert .stat-value {
  color: var(--brand-gold);
}

/* Content Split 2 Columns */
.dashboard-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* Panels */
.panel {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 20px;
  overflow: hidden;
}

.panel-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 500;
  white-space: nowrap;
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

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

.data-table tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

/* Badges & Status Indicators */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  user-select: none;
}

.badge-brand {
  background-color: var(--brand-gold-subtle);
  color: var(--brand-gold);
  border: 1px solid var(--brand-gold);
}

.badge-warning {
  background-color: var(--status-warning-subtle);
  color: #FBBF24;
  border: 1px solid var(--status-warning);
}

.badge-info {
  background-color: var(--status-info-subtle);
  color: #7DD3FC;
  border: 1px solid var(--status-info);
}

.badge-success {
  background-color: var(--status-success-subtle);
  color: #34D399;
  border: 1px solid var(--status-success);
}

.badge-danger {
  background-color: var(--status-danger-subtle);
  color: #F87171;
  border: 1px solid var(--status-danger);
}

.badge-neutral {
  background-color: var(--bg-surface-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.badge-purple {
  background-color: var(--status-purple-subtle);
  color: #C084FC;
  border: 1px solid var(--status-purple);
}

/* Icon Utilities & Normalization */
.gc-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  vertical-align: middle;
  flex-shrink: 0;
  line-height: 1;
}

.gc-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.gc-icon img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.gc-icon-xs {
  width: 12px;
  height: 12px;
}

.gc-icon-sm {
  width: 14px;
  height: 14px;
}

.gc-icon-md {
  width: 16px;
  height: 16px;
}

.gc-icon-lg {
  width: 20px;
  height: 20px;
}

.gc-icon-xl {
  width: 24px;
  height: 24px;
}

.btn .gc-icon {
  margin-right: 0;
}

/* ==========================================================================
   Icon Filters & Contrast Normalization for Dark Theme
   SVG icon files default to stroke="#000000".
   These rules dynamically invert/tint them to match their background & text.
   ========================================================================== */

/* 1. Default icons in dark layout (white/light silver) */
.gc-icon img,
img.gc-icon,
img.gc-icon-xs,
img.gc-icon-sm,
img.gc-icon-md,
img.gc-icon-lg,
img.gc-icon-xl {
  filter: brightness(0) invert(0.85); /* Visible light silver on dark surfaces */
}

/* 2. Primary Button: Yellow background, dark icon */
.btn-primary img,
.btn-primary .gc-icon img {
  filter: none !important; /* Keep #000000 high contrast on #FECA04 */
}

/* 3. Secondary Button: Yellow outline/text -> Yellow icon */
.btn-secondary img,
.btn-secondary .gc-icon img {
  filter: invert(79%) sepia(85%) saturate(740%) hue-rotate(359deg) brightness(103%) contrast(105%) !important; /* #FECA04 */
}

.btn-secondary:hover img,
.btn-secondary:hover .gc-icon img {
  filter: none !important; /* On hover, background becomes yellow -> black icon */
}

/* 4. Neutral & Ghost Buttons: Silver text on dark -> white/silver icon */
.btn-neutral img,
.btn-ghost img,
.btn-neutral .gc-icon img,
.btn-ghost .gc-icon img {
  filter: brightness(0) invert(0.9) !important; /* Crisp white/silver */
}

.btn-neutral:hover img,
.btn-ghost:hover img,
.btn-neutral:hover .gc-icon img,
.btn-ghost:hover .gc-icon img {
  filter: brightness(0) invert(1) !important;
}

/* 5. Success, Danger, Info, Purple Solid Buttons: White text -> Pure white icon */
.btn-success img,
.btn-danger img,
.btn-info img,
.btn-purple img,
.btn-success .gc-icon img,
.btn-danger .gc-icon img,
.btn-info .gc-icon img,
.btn-purple .gc-icon img {
  filter: brightness(0) invert(1) !important; /* Pure white */
}

/* 6. Danger Ghost Button: Red outline -> Red icon */
.btn-danger-ghost img,
.btn-danger-ghost .gc-icon img {
  filter: invert(37%) sepia(87%) saturate(5833%) hue-rotate(345deg) !important; /* #EF4444 */
}

.btn-danger-ghost:hover img,
.btn-danger-ghost:hover .gc-icon img {
  filter: brightness(0) invert(1) !important;
}

/* 7. Warning Buttons */
.btn-warning img,
.btn-warning .gc-icon img {
  filter: none !important; /* Dark icon on warning yellow/amber */
}

.btn-warning-ghost img,
.btn-warning-ghost .gc-icon img {
  filter: invert(75%) sepia(85%) saturate(740%) hue-rotate(359deg) !important; /* #F59E0B */
}

.btn-warning-ghost:hover img,
.btn-warning-ghost:hover .gc-icon img {
  filter: invert(75%) sepia(85%) saturate(740%) hue-rotate(359deg) !important;
}

/* 8. Segmented Control Buttons */
.btn-segmented img,
.btn-segmented .gc-icon img {
  filter: brightness(0) invert(0.65); /* #94A3B8 */
}

.btn-segmented:hover img,
.btn-segmented:hover .gc-icon img {
  filter: brightness(0) invert(0.9);
}

.btn-segmented.active img,
.btn-segmented.active .gc-icon img {
  filter: none !important; /* Yellow background -> black icon */
}

/* 8. Badges */
.badge img,
.badge .gc-icon img {
  vertical-align: middle;
}

.badge-brand img,
.badge-brand .gc-icon img {
  filter: invert(79%) sepia(85%) saturate(740%) hue-rotate(359deg) !important; /* #FECA04 */
}

.badge-success img,
.badge-success .gc-icon img {
  filter: invert(57%) sepia(48%) saturate(553%) hue-rotate(113deg) brightness(97%) contrast(93%) !important; /* #10B981 */
}

.badge-warning img,
.badge-warning .gc-icon img {
  filter: invert(75%) sepia(85%) saturate(740%) hue-rotate(359deg) !important; /* #F59E0B */
}

.badge-danger img,
.badge-danger .gc-icon img {
  filter: invert(37%) sepia(87%) saturate(5833%) hue-rotate(345deg) !important; /* #EF4444 */
}

.badge-info img,
.badge-info .gc-icon img {
  filter: invert(64%) sepia(76%) saturate(2304%) hue-rotate(174deg) brightness(99%) contrast(95%) !important; /* #38BDF8 */
}

.badge-neutral img,
.badge-neutral .gc-icon img {
  filter: brightness(0) invert(0.75) !important; /* #94A3B8 */
}

.badge-purple img,
.badge-purple .gc-icon img {
  filter: invert(67%) sepia(61%) saturate(5849%) hue-rotate(224deg) !important; /* #8B5CF6 */
}

/* Sites List Cards */
.site-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  margin-bottom: 10px;
}

.site-item:last-child {
  margin-bottom: 0;
}

.site-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.site-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Modals */
.login-overlay, .modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.login-card {
  width: 100%;
  max-width: 460px;
  background-color: var(--bg-surface);
  border: 1px solid var(--brand-gold);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
  text-align: center;
}

.modal-card {
  width: 100%;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-focus);
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
}

.login-logo {
  height: 44px;
  margin-bottom: 20px;
}

.login-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.login-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 16px;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.15s;
  height: 42px;
}

.form-input:focus {
  outline: none;
  border-color: var(--brand-gold);
  box-shadow: 0 0 0 2px rgba(254, 202, 4, 0.2);
}

.login-error {
  color: var(--status-danger);
  font-size: 13px;
  margin-top: 12px;
  display: none;
}

/* Button Groups & Segmented Controls */
.btn-group {
  display: inline-flex;
  align-items: center;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.btn-group .btn-segmented {
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-group .btn-segmented:hover {
  color: var(--text-primary);
}

.btn-group .btn-segmented.active {
  background-color: var(--brand-gold);
  color: #000000;
  font-weight: 700;
}

/* Modal Actions Bar */
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

/* Responsive (Mobile / Tablet) */
@media (max-width: 1100px) {
  .header-user-area {
    gap: 8px;
  }
  .header-user-area .btn-primary,
  .header-user-area .btn-secondary {
    padding: 6px 10px;
    font-size: 12px;
  }
}

@media (max-width: 900px) {
  .sidebar {
    display: none;
  }
  .main-wrapper {
    margin-left: 0;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dashboard-columns {
    grid-template-columns: 1fr;
  }
  #sites-view-split {
    grid-template-columns: 1fr !important;
  }
  #site-detail-panel {
    position: static !important;
    top: auto !important;
  }
  .header {
    padding: 0 16px;
    height: auto;
    min-height: var(--header-height);
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 12px;
    padding-bottom: 12px;
  }
}

/* M-04 Sites Module Enhancements */
.site-card-item {
  transition: all 0.15s ease-in-out;
}
.site-card-item:hover {
  border-color: var(--border-focus) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* M-05 Staff Ledger Module Enhancements */
.staff-card-item {
  transition: all 0.15s ease-in-out;
}
.staff-card-item:hover {
  border-color: var(--border-focus) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

@media (max-width: 960px) {
  #staff-view-split {
    grid-template-columns: 1fr !important;
  }
  #staff-detail-panel {
    position: static !important;
    top: auto !important;
  }
}

/* M-07 Dispatch & Attendance Monitoring Enhancements */
@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.dispatch-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  transition: all 0.15s ease-in-out;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dispatch-card:hover {
  border-color: var(--border-focus);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.dispatch-card.has-alert {
  border-color: rgba(239, 68, 68, 0.6) !important;
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.04) 0%, var(--bg-surface) 100%);
}

.dispatch-timeline {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  position: relative;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px 14px;
}

@media (max-width: 768px) {
  .dispatch-timeline {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
}

.timeline-step {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.timeline-step-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}
.timeline-step-header.completed {
  color: #10B981;
}
.timeline-step-header.in-progress {
  color: var(--accent-gold);
}
.timeline-step-header.warning {
  color: #EF4444;
}

.timeline-step-body {
  font-size: 12px;
  color: var(--text-muted);
}

/* Print Styles for Legal Roster & Shift Plan (警備業法第45条警備員名簿・配置計画書) */
@media print {
  body {
    background: #FFFFFF !important;
    color: #000000 !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .sidebar, .header, .modal-overlay:not(#modal-roster-print), .btn, button, input, select, .no-print {
    display: none !important;
  }
  #modal-roster-print {
    position: static !important;
    background: transparent !important;
    display: block !important;
    padding: 0 !important;
  }
  #modal-roster-print .login-card {
    max-width: 100% !important;
    width: 100% !important;
    background: #FFFFFF !important;
    color: #000000 !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  .print-page {
    page-break-after: always;
    padding: 10mm;
  }
  .print-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 11px;
    color: #000000 !important;
  }
  .print-table th, .print-table td {
    border: 1px solid #000000 !important;
    padding: 6px 8px;
    color: #000000 !important;
  }
  .print-table th {
    background: #F1F5F9 !important;
    font-weight: bold;
    text-align: center;
  }
}

/* M-02 Shifts Table Enhancements */
tr.shifts-row-unassigned {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.08) 0%, rgba(254, 202, 4, 0.03) 100%) !important;
}
tr.shifts-row-unassigned td {
  border-bottom: 1px solid rgba(239, 68, 68, 0.25) !important;
}
tr.shifts-row-unassigned:hover {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.14) 0%, rgba(254, 202, 4, 0.06) 100%) !important;
}

.profit-badge-high {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #10B981;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
}
.profit-badge-mid {
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #94A3B8;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
}
.profit-badge-low {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #EF4444;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
}

/* --- M-08 Site Review & Hazard Alert Styles --- */
.review-kpi-clickable {
  transition: all 0.2s ease;
  user-select: none;
}
.review-kpi-clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}
.review-kpi-clickable.active-filter {
  outline: 2px solid var(--status-danger);
  background: rgba(239, 68, 68, 0.08);
}

.review-card-hazard {
  border: 1px solid rgba(239, 68, 68, 0.5) !important;
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.05) 0%, rgba(26, 29, 36, 0.95) 100%) !important;
  position: relative;
}
.review-card-hazard::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--status-danger);
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
}

.review-card-superior {
  border: 1px solid rgba(254, 202, 4, 0.35) !important;
  position: relative;
}
.review-card-superior::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--brand-gold);
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
}

.comment-bubble {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s;
}
.comment-bubble:hover {
  border-color: var(--border-focus);
}

/* M-09 Wage & Payroll Extensions */
.wage-row-inactive {
  opacity: 0.6;
  background: rgba(15, 23, 42, 0.4);
}
.wage-row-inactive:hover {
  opacity: 0.9;
}
.wage-dow-sat {
  color: #60A5FA !important;
  font-weight: 700;
}
.wage-dow-sun {
  color: #F87171 !important;
  font-weight: 700;
}
.wage-rule-pill {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  display: inline-block;
  white-space: nowrap;
}
.wage-rule-pill.override {
  background: rgba(245, 158, 11, 0.15);
  color: #FBBF24;
  border-color: rgba(245, 158, 11, 0.3);
}
.wage-rule-pill.site {
  background: rgba(59, 130, 246, 0.15);
  color: #93C5FD;
  border-color: rgba(59, 130, 246, 0.3);
}



