/* ==========================================================================
   DESIGN SYSTEM & VARIABLES
   ========================================================================== */
:root {
  --font-heading: 'Segoe UI', -apple-system, BlinkMacSystemFont, Calibri, Roboto, Arial, sans-serif;
  --font-body: 'Segoe UI', -apple-system, BlinkMacSystemFont, Calibri, Roboto, Arial, sans-serif;

  /* Excel Colors */
  --bg-app: #f3f2f1; /* Excel Grid Canvas / Workspace Gray */
  --bg-sidebar: #107c41; /* Microsoft Excel Brand Green */
  --bg-card: #ffffff;
  --bg-card-hover: #faf9f8;
  --border-color: #cbd5e1; /* Cell border light gray */
  --border-default: #107c41; /* Excel Accent Green */
  --border-color-focus: #107c41;

  --text-main: #323130; /* Excel primary dark gray */
  --text-muted: #605e5c; /* Excel secondary gray */
  --text-inv: #ffffff;

  /* Theme Accents (Replaced Western Power with Excel) */
  --wp-bamboo: #165a31; /* Excel Dark Green */
  --wp-bluestone: #107c41; /* Excel Green */
  --wp-danube: #217346; /* Excel Mid Green */
  --wp-orange-accent: #c6efce; /* Excel light green fill */

  /* Accents */
  --primary: #107c41;
  --primary-glow: rgba(16, 124, 65, 0.1);
  --success: #107c41;
  --success-glow: rgba(16, 124, 65, 0.15);
  --warning: #d83b01; /* Excel warning orange */
  --warning-glow: rgba(216, 59, 1, 0.1);
  --danger: #a80000; /* Excel danger red */
  --danger-glow: rgba(168, 0, 0, 0.1);
  --purple: #5c2d91; /* Teams purple */
  --purple-glow: rgba(92, 45, 145, 0.1);

  /* Heatmap Fills - Excel Conditional Formatting Style */
  --color-zero: transparent;
  --text-zero: #8a8886;
  --color-under-low: #f2f2f2;
  --text-under-low: #595959;
  --color-under-mid: #ffeb9c; /* Excel Caution Yellow */
  --text-under-mid: #9c6500;
  --color-full: #c6efce; /* Excel Safe Green */
  --text-full: #006100;
  --color-over: #ffc7ce; /* Excel Warning Red */
  --text-over: #9c0006;

  /* Shadows & Radius (Sharp, rectangular corners like Excel desktop) */
  --shadow-sm: 0 1px 1px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 1px 3px 0 rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 2px 6px 0 rgba(0, 0, 0, 0.1);
  --radius-sm: 0px;
  --radius-md: 0px;
  --radius-lg: 0px;
  
  --transition-fast: 0.1s ease;
  --transition-normal: 0.15s ease;
}

/* ==========================================================================
   RESET & LAYOUT BASE
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 13px; /* Slightly more compact Excel size */
  line-height: 1.4;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
}

/* Excel flat scrollbars */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: #f3f2f1;
  border-left: 1px solid #d4d4d4;
  border-top: 1px solid #d4d4d4;
}
::-webkit-scrollbar-thumb {
  background: #c8c6c4;
  border-radius: 0px;
  border: 1px solid #f3f2f1;
}
::-webkit-scrollbar-thumb:hover {
  background: #a19f9d;
}

.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* ==========================================================================
   SIDEBAR NAVIGATION (Excel Backstage File Panel style)
   ========================================================================== */
.sidebar {
  width: 240px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid #0f703b;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #0f703b;
  min-width: 0;
}

.sidebar-logo-link {
  min-width: 0;
  flex: 1;
}

.logo-text {
  min-width: 0;
  overflow: hidden;
}

.logo-text span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logo-icon {
  background-color: #ffffff !important;
  width: 32px;
  height: 32px;
  border-radius: 0px !important; /* Sharp corners */
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none !important;
  position: relative;
  border: 1px solid #ffffff;
}

.logo-icon::before {
  content: "X";
  color: #107c41;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-weight: 800;
  font-size: 20px;
  line-height: 1;
  margin-top: -1px;
}

.logo-icon i, .logo-icon svg {
  display: none !important; /* Hide the layers icon */
}

.logo-text h1 {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  line-height: 1.2;
  color: #ffffff;
}

.logo-text span {
  font-size: 10px;
  color: #c6efce;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.nav-btn {
  background: none;
  border: none;
  color: #e2f0d9;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 0px; /* Sharp corners */
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  transition: var(--transition-fast);
}

.nav-btn:hover {
  background-color: #165a31;
  color: #ffffff;
}

.nav-btn.active {
  background-color: #115c32; /* Deep excel active state */
  color: #ffffff;
  box-shadow: inset 4px 0 0 #ffffff; /* White active border */
  font-weight: 600;
}

.nav-btn i, .nav-btn svg {
  width: 16px;
  height: 16px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid #0f703b;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.location-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #e2f0d9;
  font-size: 11px;
  background-color: rgba(255, 255, 255, 0.08);
  padding: 6px 10px;
  border-radius: 0px; /* Sharp corners */
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.location-badge i, .location-badge svg {
  width: 13px;
  height: 13px;
  color: #ffffff;
}

.version-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
}

/* ==========================================================================
   MAIN CONTENT AREA (Excel Workspace)
   ========================================================================== */
.main-content {
  flex-grow: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  height: 100vh;
  background-color: var(--bg-app);
}

/* Content Header styled like Excel Toolbar/Ribbon section */
.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: -20px -20px 20px -20px;
  padding: 12px 24px;
  background-color: #ffffff;
  border-bottom: 1px solid #d4d4d4;
  gap: 20px;
}

.header-left h2 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
  color: #323130;
  letter-spacing: -0.2px;
}

.header-left p {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 2px;
}

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

/* Search bar styling - Excel Tell Me style */
.search-box {
  position: relative;
  width: 260px;
}

.search-box i, .search-box svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 14px;
  height: 14px;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  background-color: #ffffff;
  border: 1px solid #a19f9d;
  color: var(--text-main);
  padding: 6px 10px 6px 32px;
  border-radius: 0px; /* Sharp corners */
  font-family: var(--font-body);
  font-size: 12px;
  transition: var(--transition-fast);
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

/* ==========================================================================
   BUTTONS & CARDS (Office Fluent/Excel style)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  border-radius: 0px; /* Sharp corners */
  border: 1px solid #cbd5e1;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.btn i, .btn svg {
  width: 14px;
  height: 14px;
}

.btn-primary {
  background-color: var(--primary);
  border: 1px solid #0f703b;
  color: #ffffff;
  box-shadow: none;
}
.btn-primary:hover {
  background-color: var(--wp-bamboo);
  border-color: #114c29;
  color: #ffffff;
  box-shadow: none;
  transform: none;
}

.btn-edit-icon {
  background-color: #f3f2f1;
  border: 1px solid #cbd5e1;
  color: #323130 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 0px;
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-edit-icon:hover {
  background-color: #e2f0d9;
  border-color: #107c41;
  color: #107c41 !important;
}

.btn-delete-icon {
  background-color: #f3f2f1;
  border: 1px solid #cbd5e1;
  color: #a80000 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 0px;
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-delete-icon:hover {
  background-color: #ffc7ce;
  border-color: #a80000;
  color: #a80000 !important;
}

.btn-success {
  background: var(--primary);
  border-color: #0f703b;
  color: #fff;
  box-shadow: none;
}
.btn-success:hover {
  background-color: var(--wp-bamboo);
  box-shadow: none;
  transform: none;
}

.btn-outline {
  background-color: #ffffff;
  border-color: #cbd5e1;
  color: var(--text-main);
}
.btn-outline:hover {
  background-color: #f3f2f1;
  border-color: #a19f9d;
  color: var(--text-main);
}

.card-header .btn-outline {
  background-color: #ffffff;
  border-color: #cbd5e1;
  color: var(--text-main);
}
.card-header .btn-outline:hover {
  background-color: #f3f2f1;
  border-color: #a19f9d;
  color: var(--text-main);
}
.card-header .btn-outline.active {
  background-color: #e2f0d9;
  border-color: #107c41;
  color: #107c41;
  font-weight: 600;
}

.btn-danger-outline {
  background-color: #ffffff;
  border-color: #ffc7ce;
  color: #a80000;
}
.btn-danger-outline:hover {
  background-color: #ffc7ce;
  border-color: #a80000;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 11px;
}
.btn-xs {
  padding: 3px 6px;
  font-size: 11px;
  border-radius: 0px;
}

.btn-group {
  display: inline-flex;
  border-radius: 0px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
}
.btn-group .btn {
  border-radius: 0;
  border: none;
  border-right: 1px solid #cbd5e1;
}
.btn-group .btn:last-child {
  border-right: none;
}
.btn-group .btn.active {
  background-color: #e2f0d9;
  color: #107c41;
  font-weight: 600;
}

/* Card layout - Excel Panel style */
.card {
  background-color: var(--bg-card);
  border: 1px solid #cbd5e1;
  border-top: 3px solid var(--border-default);
  border-radius: 0px; /* Sharp corners */
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: none;
}
.card:hover {
  background-color: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 12px 20px;
  background-color: #f3f2f1; /* Light ribbon gray */
  border-bottom: 1px solid #cbd5e1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-main);
}

.card-header h3 {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.1px;
  color: var(--text-main);
}

.card-subtitle {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 2px;
}

.card-body {
  padding: 16px;
}

.p-0 {
  padding: 0 !important;
}
.mt-3 {
  margin-top: 12px !important;
}
.mt-4 {
  margin-top: 16px !important;
}

/* ==========================================================================
   TAB PANELS & STATS GRID
   ========================================================================== */
.tab-panel {
  display: none;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn 0.15s ease;
}

.tab-panel.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Dashboard statistics cards styled as clean Excel boxes */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-card {
  background-color: var(--bg-card);
  border: 1px solid #cbd5e1;
  border-radius: 0px; /* Sharp corners */
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: none;
  transition: none;
}
.stat-card:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--primary);
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 0px; /* Sharp corners */
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-icon i, .stat-icon svg {
  width: 18px;
  height: 18px;
}

.icon-orange { background-color: #fdf6ec; color: #e6a23c; }
.icon-green { background-color: #f0f9eb; color: #107c41; }
.icon-red { background-color: #fef0f0; color: #a80000; }
.icon-danube { background-color: #f0f5ff; color: #217346; }

.stat-info h3 {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-info p {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
  margin: 1px 0;
  color: #323130;
}

.stat-info span {
  font-size: 10px;
  color: var(--text-muted);
}

/* ==========================================================================
   CHARTS & GRIDS
   ========================================================================== */
.chart-container {
  position: relative;
  height: 250px;
  width: 100%;
}

.dashboard-chart-card {
  flex-grow: 1;
}

/* ==========================================================================
   TABLES & HEATMAP
   ========================================================================== */
.table-container {
  overflow-x: auto;
  max-width: 100%;
  background-color: #ffffff;
  border: 1px solid #d4d4d4;
}

.planner-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12px; /* Standard spreadsheet compact size */
}

.planner-table th {
  background-color: #f3f2f1; /* Excel header gray */
  color: #323130; /* Header text */
  font-weight: 500;
  padding: 6px 12px;
  border: 1px solid #d4d4d4; /* Full header gridlines */
  border-bottom: 2px solid #c8c6c4;
  white-space: nowrap;
  font-size: 11px;
}

.planner-table td {
  padding: 6px 12px;
  border: 1px solid #e1e1e1; /* Thin gray gridlines */
  color: var(--text-main);
  white-space: nowrap;
  background-color: #ffffff;
}

.planner-table tbody tr {
  transition: none;
}

.planner-table tbody tr:hover {
  background-color: #f2f9f0 !important; /* Excel soft green row highlight */
}

/* Ensure sub-rows also look good */
.planner-table tbody tr.project-row:hover {
  background-color: #e2f0d9 !important;
}

.table-sm th, .table-sm td {
  padding: 4px 8px;
  font-size: 11px;
}

/* Heatmap-specific cells */
.heatmap-cell {
  text-align: center;
  font-weight: 600;
  padding: 4px !important;
  font-size: 11px;
  min-width: 55px;
  border: 1px solid #e1e1e1 !important;
}

.heatmap-cell-val {
  padding: 3px 4px;
  border-radius: 0px; /* Sharp corners */
  display: block;
}

.cell-zero {
  background-color: var(--color-zero);
  color: var(--text-zero);
  font-weight: normal;
  opacity: 0.6;
}

.cell-under-low {
  background-color: var(--color-under-low);
  color: var(--text-under-low);
  font-weight: 500;
}

.cell-under-mid {
  background-color: var(--color-under-mid);
  color: var(--text-under-mid);
}

.cell-full {
  background-color: var(--color-full);
  color: var(--text-full);
}

.cell-over {
  background-color: var(--color-over);
  color: var(--text-over);
}

.legend-indicators {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.badge {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 0px; /* Sharp */
}
.badge-zero { background-color: #ffffff; border: 1px solid #cbd5e1; }
.badge-under-low { background-color: var(--color-under-low); border: 1px solid #cbd5e1; }
.badge-under-mid { background-color: var(--color-under-mid); }
.badge-full { background-color: var(--color-full); }
.badge-over { background-color: var(--color-over); }

/* ==========================================================================
   SPREADSHEET VIEW (INLINE EDITABLE FORECAST)
   ========================================================================== */
.spreadsheet-view {
  max-height: 550px;
  overflow-y: auto;
}

.spreadsheet-table th {
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: inset 0 -1px 0 #cbd5e1;
}

td.editable-cell {
  cursor: cell; /* Excel crosshair cursor */
  position: relative;
  transition: none;
}

td.editable-cell:hover {
  background-color: #ffffff;
  outline: 1px solid #107c41; /* Green border on hover */
  outline-offset: -1px;
}

.spreadsheet-table td.read-only-cell {
  background-color: #faf9f8 !important; /* Soft gray lock background */
  color: var(--text-muted);
  cursor: not-allowed;
}

/* Editing input inside cell - Excel active cell border */
.cell-edit-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #ffffff;
  border: 2px solid #107c41; /* Thick Excel Green active cell border */
  color: #000000;
  border-radius: 0px; /* Sharp corners */
  text-align: center;
  font-weight: 500;
  font-family: var(--font-body);
  font-size: 12px;
  outline: none;
  box-shadow: none;
  z-index: 5;
}

.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 0px; /* Sharp corners */
  text-transform: uppercase;
}

.badge-float {
  background-color: #deecf9; /* Office light blue */
  color: #106ebe;
}

.badge-direct {
  background-color: #efe5fd; /* Office light purple */
  color: #5c2d91;
}

.status-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 0px; /* Sharp corners */
}
.status-active {
  background-color: #c6efce;
  color: #006100;
  border: 1px solid #c6efce;
}
.status-inactive {
  background-color: #f3f2f1;
  color: var(--text-muted);
  border: 1px solid #cbd5e1;
}

/* ==========================================================================
   FILTER BAR
   ========================================================================== */
.filter-bar {
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 0px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.filter-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-col label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.filter-bar-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid #f3f2f1;
  padding-top: 10px;
}

.results-count {
  font-size: 11px;
  color: var(--text-muted);
}

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

/* Form controls - Flat Excel style */
.form-control {
  width: 100%;
  background-color: #ffffff;
  border: 1px solid #a19f9d;
  color: var(--text-main);
  padding: 5px 8px;
  border-radius: 0px; /* Sharp corners */
  font-family: var(--font-body);
  font-size: 12px;
  transition: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.select-sm {
  padding: 3px 6px;
  font-size: 11px;
  border-radius: 0px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ==========================================================================
   IMPORT PANEL & PREVIEW
   ========================================================================== */
.import-layout-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  align-items: start;
}

.dropzone {
  border: 2px dashed #a19f9d;
  border-radius: 0px; /* Sharp corners */
  padding: 30px 16px;
  text-align: center;
  cursor: pointer;
  background-color: #ffffff;
  transition: var(--transition-fast);
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background-color: #f2f9f0;
}

.dropzone i {
  width: 40px;
  height: 40px;
  color: var(--text-muted);
  margin-bottom: 8px;
  transition: none;
}
.dropzone:hover i {
  color: var(--primary);
  transform: none;
}

.dropzone-title {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
}
.dropzone-or {
  color: var(--text-muted);
  font-size: 11px;
  margin: 4px 0 8px;
}
.file-type-hint {
  font-size: 10px;
  color: var(--text-muted);
}

.dropzone-file-selected {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.dropzone-file-selected i {
  color: var(--primary);
  margin-bottom: 0;
}
.selected-file-name {
  font-weight: 600;
  word-break: break-all;
  font-size: 12px;
}

.import-rules {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid #cbd5e1;
  background-color: #ffffff;
}
.import-rules h4 {
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  color: #323130;
}
.import-rules ul {
  padding-left: 16px;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.import-preview-empty {
  min-height: 350px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #cbd5e1;
  background-color: #ffffff;
}
.empty-state {
  text-align: center;
  max-width: 280px;
  color: var(--text-muted);
}
.empty-state i {
  width: 40px;
  height: 40px;
  margin-bottom: 12px;
  stroke-width: 1.5;
}
.empty-state h3 {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}
.empty-state p {
  font-size: 11px;
}

.import-preview-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.preview-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.preview-stat-card {
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 0px; /* Sharp corners */
  padding: 12px;
  text-align: center;
}
.preview-stat-card h4 {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 600;
  color: #323130;
}
.preview-stat-card span {
  font-size: 10px;
  color: var(--text-muted);
}

.alert-warning-header {
  border-bottom: 1px solid #ffeb9c;
}
.alert-warning-header i {
  color: #9c6500;
}
.alert-danger-header {
  border-bottom: 1px solid #ffc7ce;
}
.alert-danger-header i {
  color: #9c0006;
}

.alert-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.alert-list li {
  background-color: #ffeb9c;
  border: 1px solid #ffeb9c;
  color: #9c6500;
  padding: 8px 12px;
  border-radius: 0px;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.alert-list li strong {
  color: #9c6500;
}
.capacity-exceeded-badge {
  background-color: #ffc7ce;
  color: #9c0006;
  padding: 1px 6px;
  border-radius: 0px;
  font-weight: 600;
}

.preview-confirm-card .card-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.confirm-text {
  display: flex;
  align-items: center;
  gap: 10px;
}
.confirm-text i {
  width: 24px;
  height: 24px;
  color: var(--primary);
}
.confirm-text h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 13px;
}
.confirm-text p {
  font-size: 11px;
  color: var(--text-muted);
}

/* ==========================================================================
   SETTINGS LAYOUT & SUBTABS
   ========================================================================== */
.settings-tabs {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 20px;
  align-items: start;
}

.settings-sidebar {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  padding: 8px 12px;
  border-radius: 0px; /* Sharp corners */
  cursor: pointer;
  transition: var(--transition-fast);
}
.settings-tab-btn:hover {
  background-color: #cbd5e1;
  color: var(--text-main);
}
.settings-tab-btn.active {
  background-color: #ffffff;
  color: var(--primary);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--primary);
  border: 1px solid #cbd5e1;
  border-right: none;
}

.settings-subpanel {
  display: none;
  animation: fadeIn 0.15s ease;
}
.settings-subpanel.active {
  display: block;
}

.subpanel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.roles-locations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

/* ==========================================================================
   DIALOG POPUPS & ALERTS (Excel popup boxes)
   ========================================================================== */
.app-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  background-color: #ffffff;
  border: 1px solid #a19f9d; /* Sharp gray Excel border */
  border-radius: 0px; /* Sharp corners */
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  color: var(--text-main);
  padding: 0;
  max-width: 480px;
  width: 90%;
  outline: none;
  z-index: 9999;
}
.app-dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.3);
  backdrop-filter: none;
}

.dialog-header {
  padding: 10px 16px;
  background-color: var(--primary); /* Excel Green dialog header */
  border-bottom: 1px solid #0f703b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #ffffff;
}
.dialog-header h3 {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
}
.dialog-close-btn {
  background: none;
  border: none;
  color: #ffffff;
  cursor: pointer;
  padding: 2px;
  border-radius: 0px;
  display: flex;
  transition: var(--transition-fast);
}
.dialog-close-btn:hover {
  background-color: #165a31;
  color: #ffffff;
}

.app-dialog form {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

/* ==========================================================================
   TOAST NOTIFICATION & MISC (Excel-style Clean Notifications)
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background-color: #ffffff;
  border-left: 4px solid var(--primary);
  border-radius: 0px; /* Sharp corners */
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  color: var(--text-main);
  padding: 10px 14px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideIn 0.15s ease-out;
  min-width: 240px;
  border-top: 1px solid #cbd5e1;
  border-right: 1px solid #cbd5e1;
  border-bottom: 1px solid #cbd5e1;
}

.toast-success { border-left-color: #107c41; }
.toast-error { border-left-color: #a80000; }
.toast-warning { border-left-color: #d83b01; }

@keyframes slideIn {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-fadeout {
  animation: slideOut 0.15s ease-in forwards;
}

@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(120%); opacity: 0; }
}

.sheet-info-header {
  background-color: #deecf9; /* Office light blue info card */
  border: 1px solid #cbd5e1;
  padding: 8px 12px;
  border-radius: 0px; /* Sharp corners */
  font-size: 11px;
  color: #106ebe;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.sheet-info-header i {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: #106ebe;
}

/* ==========================================================================
   SIDEBAR COLLAPSIBILITY
   ========================================================================== */
.sidebar {
  transition: width var(--transition-normal);
  position: relative;
}

.app-container.sidebar-collapsed .sidebar {
  width: 60px;
}

/* Sidebar toggle button */
.btn-sidebar-toggle {
  background: none;
  border: none;
  color: #e2f0d9;
  cursor: pointer;
  padding: 4px;
  border-radius: 0px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  margin-left: auto;
}
.btn-sidebar-toggle:hover {
  background-color: #165a31;
  color: #fff;
}
.btn-sidebar-toggle i, .btn-sidebar-toggle svg {
  width: 14px;
  height: 14px;
  transition: transform var(--transition-normal);
}
.app-container.sidebar-collapsed .btn-sidebar-toggle i,
.app-container.sidebar-collapsed .btn-sidebar-toggle svg {
  transform: rotate(180deg);
}

/* Collapsed content adjustments */
.app-container.sidebar-collapsed .sidebar .logo-text,
.app-container.sidebar-collapsed .sidebar .sidebar-nav span,
.app-container.sidebar-collapsed .sidebar .location-badge span,
.app-container.sidebar-collapsed .sidebar .version-label {
  display: none !important;
}

.app-container.sidebar-collapsed .sidebar .sidebar-logo {
  padding: 16px 12px;
  justify-content: center;
}
.app-container.sidebar-collapsed .sidebar .sidebar-nav {
  padding: 16px 8px;
  align-items: center;
}
.app-container.sidebar-collapsed .sidebar .nav-btn {
  padding: 10px;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 0px;
}
.app-container.sidebar-collapsed .sidebar .sidebar-footer {
  padding: 8px;
  align-items: center;
}
.app-container.sidebar-collapsed .sidebar .location-badge {
  padding: 8px;
  border-radius: 0px;
}

/* ==========================================================================
   SORTABLE HEADERS & INLINE COLUMN FILTERS
   ========================================================================== */
th.sortable-header {
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: background-color var(--transition-fast);
}
th.sortable-header:hover {
  background-color: #e1dfdd !important; /* Excel gray hover */
}
th.sortable-header .sort-icon {
  width: 12px;
  height: 12px;
  vertical-align: middle;
  margin-left: 2px;
  opacity: 0.4;
  transition: opacity var(--transition-fast);
}
th.sortable-header:hover .sort-icon,
th.sortable-header.sorted .sort-icon {
  opacity: 1;
  color: var(--primary);
}

.filter-row td {
  padding: 4px 6px !important;
  background-color: #f3f2f1 !important; /* Excel gray input row */
  border-bottom: 1px solid #cbd5e1 !important;
}
.filter-row .col-filter-input {
  width: 100%;
  background-color: #ffffff;
  border: 1px solid #a19f9d;
  border-radius: 0px; /* Sharp corners */
  padding: 2px 6px;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 11px;
  outline: none;
  transition: none;
}
.filter-row .col-filter-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

/* Column Manager checklist item styles */
.col-check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 0px; /* Sharp corners */
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  transition: none;
}
.col-check-label:hover {
  background-color: #f3f2f1;
  border-color: #a19f9d;
}.col-check-label input {
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* Security Gateway Splash Screen */
.security-gateway {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at center, #165a31 0%, #0b361c 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.splash-card {
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  border-top: 4px solid #107c41;
  animation: splashFadeIn 0.5s ease-out;
}

@keyframes splashFadeIn {
  from { transform: translateY(15px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.splash-logo img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  margin-bottom: 20px;
}

.splash-card h2 {
  font-size: 20px;
  font-weight: 600;
  color: #323130;
  margin-bottom: 4px;
}

.splash-subtitle {
  font-size: 11px;
  text-transform: uppercase;
  color: #605e5c;
  letter-spacing: 1px;
  margin-bottom: 30px;
}

.gateway-error-msg {
  color: #a80000;
  font-size: 11px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.splash-btn {
  width: 100%;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  background-color: #107c41;
  border-color: #0f703b;
  color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.splash-btn:hover {
  background-color: #165a31;
}

.splash-footer {
  margin-top: 30px;
  font-size: 10px;
  color: #a19f9d;
}

/* Table Column Resizer Handle */
th {
  position: relative;
}

.resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 5px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  z-index: 10;
  background-color: transparent;
}
.resize-handle:hover {
  background-color: #107c41;
}

body.resizing-col, body.resizing-col * {
  cursor: col-resize !important;
  user-select: none !important;
}

/* Sidebar Resizer Handle */
.sidebar {
  position: relative;
}

.sidebar-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 100%;
  cursor: col-resize;
  z-index: 110;
  background-color: transparent;
  transition: background-color 0.2s;
}

.sidebar-resizer:hover, body.resizing-sidebar .sidebar-resizer {
  background-color: rgba(255, 255, 255, 0.25);
}

body.resizing-sidebar, body.resizing-sidebar * {
  cursor: col-resize !important;
  user-select: none !important;
}

body.resizing-sidebar .sidebar {
  transition: none !important;
}

/* Helper rules to ensure Lucide SVGs style size and color correctly */
#current-tab-icon, #current-tab-icon-container svg {
  width: 20px !important;
  height: 20px !important;
}
.nav-btn svg {
  width: 16px !important;
  height: 16px !important;
}
.location-badge svg {
  width: 13px !important;
  height: 13px !important;
}
.btn svg {
  width: 14px !important;
  height: 14px !important;
}
.stat-icon svg {
  width: 18px !important;
  height: 18px !important;
}
.btn-sidebar-toggle svg {
  width: 14px !important;
  height: 14px !important;
}
.search-box svg {
  width: 14px !important;
  height: 14px !important;
}

/* Elegant action buttons and lock indicators */
.action-cell-btn {
  background: transparent !important;
  border: none !important;
  color: #94a3b8 !important;
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
  width: 26px;
  height: 26px;
}
.action-cell-btn:hover {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #ef4444 !important;
}
.lock-icon-indicator {
  color: #64748b !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  width: 26px;
  height: 26px;
}

