* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", sans-serif;
  background: #f6f7fb;
  color: #1f2430;
}

.auth-hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #1a1f3c 0%, #2a3058 52%, #6f7cff 100%);
}

.login-card {
  width: min(420px, 100%);
  padding: 34px;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(10, 14, 36, 0.28);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-card h1 {
  margin: 0;
  font-size: 28px;
  color: #1f2430;
}

.login-card p {
  margin: 0 0 8px;
  color: #666f8d;
}

.login-card input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid #dfe4ef;
  border-radius: 14px;
  font-size: 14px;
}

.login-message {
  min-height: 20px;
  color: #e25a7d;
  font-size: 13px;
}

/* Admin Layout - Sidebar + Main Content */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: linear-gradient(180deg, #1a1f3c 0%, #2a3058 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
  z-index: 100;
}

.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-eyebrow {
  font-size: 11px;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.5);
}

.brand-title {
  font-size: 18px;
  font-weight: 600;
  margin-top: 8px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}

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

.nav-item.active {
  background: linear-gradient(135deg, #6f7cff, #9a6dff);
  color: #fff;
}

.nav-icon {
  font-size: 18px;
}

.nav-text {
  font-size: 14px;
  font-weight: 500;
}

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

.current-admin {
  margin-bottom: 10px;
  padding: 0 4px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
}

.refresh-button {
  width: 100%;
  padding: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: none;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.refresh-button:hover {
  background: rgba(255, 255, 255, 0.25);
}

.logout-button {
  margin-top: 10px;
  background: rgba(226, 90, 125, 0.24);
}

/* Main content area */
.main-content {
  flex: 1;
  margin-left: 240px;
  padding: 32px 40px;
  background: #f6f7fb;
  min-height: 100vh;
}

.page-content {
  display: none;
}

.page-content.active {
  display: block;
}

.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 600;
  color: #1f2430;
}

.page-header p {
  color: #666f8d;
  margin-top: 8px;
}

/* Dashboard - Enhanced stats grid */
.stats-grid-enhanced {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card-large {
  background: #fff;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(31, 36, 48, 0.06);
  display: flex;
  flex-direction: column;
}

.stat-card-large span {
  font-size: 13px;
  color: #7d84a1;
}

.stat-card-large strong {
  font-size: 42px;
  font-weight: 600;
  color: #1f2430;
  margin-top: 12px;
}

.stat-card-large small {
  font-size: 12px;
  color: #666f8d;
  margin-top: 8px;
}

/* Charts grid */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.chart-panel {
  background: #fff;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(31, 36, 48, 0.06);
}

.chart-container {
  height: 280px;
  position: relative;
}

/* Tabs container */
.tabs-container {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(31, 36, 48, 0.06);
  overflow: hidden;
}

.tabs-header {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #edf0f5;
  padding: 0;
}

.tab-btn {
  padding: 16px 24px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 14px;
  font-weight: 500;
  color: #7d84a1;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: #5362d9;
}

.tab-btn.active {
  color: #5362d9;
  border-bottom-color: #5362d9;
}

.tabs-content {
  padding: 20px;
}

.tab-panel {
  display: none;
}

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

.panel-section {
  margin-bottom: 24px;
}

.panel-section:last-child {
  margin-bottom: 0;
}

.panel-section h4 {
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 600;
}

/* Full width panel */
.panel.full-width {
  width: 100%;
  margin-bottom: 24px;
}

/* Keep existing styles below */
.page-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.14em;
  color: #7d84a1;
  margin-bottom: 10px;
}

h1,
h2,
h3 {
  margin: 0;
}

.subtext,
.panel-header p {
  color: #666f8d;
  margin-top: 10px;
}

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

.stat-card,
.panel,
.issue-card {
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(31, 36, 48, 0.06);
}

.stat-card {
  padding: 20px;
}

.stat-card span {
  display: block;
  font-size: 14px;
  color: #7d84a1;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 34px;
}

.panel {
  padding: 20px;
  margin-bottom: 20px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.compact-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-block span {
  font-size: 14px;
  font-weight: 600;
  color: #1f2430;
}

.field-block small {
  min-height: 34px;
  color: #666f8d;
  font-size: 12px;
  line-height: 1.45;
}

.field-block input,
.field-block select {
  width: 100%;
}

.form-grid input,
.form-grid select {
  height: 42px;
  border-radius: 12px;
  border: 1px solid #dde3ee;
  padding: 0 12px;
  font-size: 14px;
  background: #fff;
}

.upload-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 12px;
}

.weekday-picker {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.weekday-picker button {
  border: 1px solid #dde3ee;
  border-radius: 12px;
  background: #fff;
  color: #5362d9;
  height: 42px;
  cursor: pointer;
  font-size: 14px;
}

.weekday-picker button.active {
  background: linear-gradient(135deg, #6f7cff, #9a6dff);
  border-color: transparent;
  color: #fff;
}

.full-span {
  grid-column: 1 / -1;
}

.table-wrap {
  overflow-x: auto;
}

.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 0 4px;
}

.page-btn {
  min-width: 76px;
  height: 34px;
  border: 1px solid #dde3ee;
  border-radius: 999px;
  background: #fff;
  color: #5362d9;
  cursor: pointer;
}

.page-btn:disabled {
  cursor: not-allowed;
  color: #a8afc3;
  background: #f4f6fb;
}

.page-info {
  color: #666f8d;
  font-size: 13px;
}

table + .pagination-controls {
  margin-top: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid #edf0f5;
  font-size: 14px;
  white-space: nowrap;
  vertical-align: top;
}

th {
  color: #7d84a1;
  font-weight: 600;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.three-col {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.issue-workspace {
  margin-bottom: 20px;
  background: linear-gradient(180deg, #fbfbff 0%, #ffffff 100%);
}

.issue-header {
  align-items: flex-start;
}

.issue-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr 1fr;
  gap: 16px;
}

.secondary-grid {
  margin-top: 16px;
  grid-template-columns: 1fr 1fr;
}

.issue-card {
  padding: 18px;
}

.issue-card h3 {
  margin-bottom: 14px;
  font-size: 16px;
}

.info-stack {
  display: grid;
  gap: 12px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #f7f8fc;
}

.info-item span {
  color: #7d84a1;
  font-size: 12px;
}

.info-item strong {
  font-size: 14px;
  color: #1f2430;
  white-space: normal;
}

.info-item.holder-hint {
  background: #eef2ff;
  color: #4d5bd1;
}

.issue-user-search-status {
  margin-top: -2px;
}

.empty-state {
  color: #666f8d;
}

.info-item.full-width,
.full-width {
  grid-column: 1 / -1;
}

.search-select-stack {
  display: grid;
  gap: 12px;
}

.info-item.is-accent {
  background: rgba(111, 124, 255, 0.08);
}

.info-item.is-warning {
  background: #fff7e8;
}

.info-item.is-warning strong {
  color: #c27a00;
}

.mini-card {
  border: 1px solid #edf0f5;
  border-radius: 16px;
  padding: 14px;
  background: #fff;
}

.mini-card.is-highlight,
.highlight-row {
  background: rgba(111, 124, 255, 0.08);
}

.mini-card-title,
.result-title {
  font-weight: 600;
  margin-bottom: 8px;
}

.mini-card-meta {
  color: #666f8d;
  font-size: 13px;
  line-height: 1.5;
}

.compact-records {
  gap: 8px;
}

.compact-record {
  border: 1px solid #edf0f5;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}

.compact-record.is-highlight {
  background: rgba(111, 124, 255, 0.08);
}

.compact-record-main {
  font-size: 13px;
  line-height: 1.5;
  color: #1f2430;
  white-space: normal;
}

.compact-record-sub {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.5;
  color: #666f8d;
  white-space: normal;
}

.result-card {
  border-radius: 16px;
  padding: 16px;
}

.result-card.is-success {
  background: linear-gradient(135deg, rgba(111, 124, 255, 0.1), rgba(154, 109, 255, 0.08));
  border: 1px solid rgba(111, 124, 255, 0.18);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.admin-toast {
  position: fixed;
  top: 18px;
  right: 24px;
  z-index: 1000;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 14px;
  background: #1f2430;
  color: #fff;
  box-shadow: 0 12px 32px rgba(31, 36, 48, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.admin-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.admin-toast.is-error {
  background: #e25a7d;
}

.primary-button,
.danger-button,
.secondary-button {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 14px;
  cursor: pointer;
}

.primary-button {
  background: linear-gradient(135deg, #6f7cff, #9a6dff);
  color: #ffffff;
}

.danger-button {
  background: rgba(255, 95, 135, 0.12);
  color: #ff4d79;
}

.secondary-button {
  background: #eef2ff;
  color: #5362d9;
}

.danger-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: #eef2ff;
  color: #5362d9;
}

.status-pill.cancelled {
  background: #fff0f3;
  color: #e25a7d;
}

.muted-text {
  color: #666f8d;
  font-size: 12px;
  white-space: normal;
}

.card-edit-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
  background: #f8f9ff;
  border: 1px solid #e5e8ff;
  border-radius: 16px;
}

.card-edit-panel label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: #666f8d;
}

.card-edit-panel input,
.card-edit-panel select {
  height: 38px;
  border-radius: 10px;
  border: 1px solid #dde3ee;
  padding: 0 10px;
  background: #fff;
  color: #1f2430;
}

.card-edit-actions {
  display: flex;
  align-items: end;
  gap: 8px;
}


.muted-text.error-text {
  color: #e25a7d;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 1120px) {
  .three-col,
  .issue-grid,
  .secondary-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .stats-grid,
  .two-col,
  .form-grid,
  .compact-grid,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .card-edit-panel {
    grid-template-columns: 1fr;
  }

}

/* Admin Layout Responsive */
@media (max-width: 1200px) {
  .sidebar {
    width: 200px;
  }

  .main-content {
    margin-left: 200px;
    padding: 24px;
  }

  .stats-grid-enhanced {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 60px;
    overflow: hidden;
  }

  .sidebar-brand,
  .sidebar-footer {
    padding: 16px 8px;
  }

  .brand-title,
  .nav-text,
  .refresh-button {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 14px;
  }

  .nav-icon {
    font-size: 20px;
  }

  .main-content {
    margin-left: 60px;
    padding: 16px;
  }

  .stats-grid-enhanced {
    grid-template-columns: 1fr;
  }

  .finance-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finance-filter-row {
    align-items: stretch;
  }

  .finance-filter-row input,
  .finance-filter-row button {
    flex: 1 1 140px;
  }

  .page-header h1 {
    font-size: 24px;
  }

  .stat-card-large strong {
    font-size: 32px;
  }

  .tabs-header {
    flex-wrap: wrap;
  }

  .tab-btn {
    padding: 12px 16px;
    font-size: 13px;
  }
}

/* Search row with clear button */
.search-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-row input {
  flex: 1;
}

.clear-btn {
  padding: 10px 16px;
  border-radius: 999px;
  background: #f0f2f5;
  color: #666f8d;
  border: none;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.clear-btn:hover {
  background: #e0e3e8;
  color: #1f2430;
}

.table-search-row {
  margin-bottom: 16px;
}

.issue-user-actions {
  margin-top: 10px;
}

.finance-filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.finance-filter-row input {
  height: 40px;
  border-radius: 12px;
  border: 1px solid #dde3ee;
  padding: 0 12px;
  font-size: 14px;
}

.finance-stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.issue-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.issue-action-row .primary-button,
.issue-action-row .secondary-button {
  width: auto;
}

.mini-card-title.sub-title {
  margin-top: 10px;
  margin-bottom: 6px;
  font-size: 13px;
  color: #5362d9;
}

.secondary-button:disabled,
.danger-button:disabled,
.clear-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  body {
    background: #f6f7fb;
  }

  .admin-layout {
    display: block;
    min-height: 100vh;
  }

  .sidebar {
    width: 100%;
    height: 76px;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    flex-direction: row;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -10px 30px rgba(31, 36, 48, 0.18);
  }

  .sidebar-brand,
  .sidebar-footer {
    display: none;
  }

  .sidebar-nav {
    flex: 1;
    flex-direction: row;
    gap: 8px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar-nav::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    flex: 0 0 72px;
    min-width: 72px;
    height: 58px;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 8px 6px;
    border-radius: 16px;
    text-align: center;
  }

  .nav-icon {
    font-size: 18px;
    line-height: 1;
  }

  .nav-text {
    display: block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
    font-weight: 500;
  }

  .main-content {
    margin-left: 0;
    padding: 18px 14px 104px;
  }

  .page-header {
    margin-bottom: 16px;
  }

  .page-header h1 {
    font-size: 22px;
  }

  .page-header p {
    font-size: 13px;
    line-height: 1.5;
  }

  .stats-grid-enhanced,
  .stats-grid,
  .finance-stats-grid,
  .charts-grid,
  .two-col,
  .three-col,
  .issue-grid,
  .secondary-grid,
  .form-grid,
  .compact-grid,
  .result-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .stat-card-large,
  .stat-card,
  .panel,
  .issue-card,
  .chart-panel,
  .tabs-container {
    border-radius: 16px;
  }

  .stat-card-large {
    padding: 18px;
  }

  .stat-card-large strong {
    font-size: 30px;
  }

  .panel,
  .issue-card,
  .chart-panel {
    padding: 16px;
  }

  .panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .chart-container {
    height: 240px;
  }

  .tabs-header {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .tabs-header::-webkit-scrollbar {
    display: none;
  }

  .tab-btn {
    flex: 0 0 auto;
    padding: 13px 16px;
    white-space: nowrap;
  }

  .tabs-content {
    padding: 14px;
  }

  .form-grid input,
  .form-grid select,
  .finance-filter-row input {
    height: 46px;
    font-size: 15px;
    border-radius: 14px;
  }

  .search-row,
  .finance-filter-row,
  .issue-action-row,
  .actions-row {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button,
  .secondary-button,
  .danger-button,
  .clear-btn,
  .page-btn,
  .issue-action-row .primary-button,
  .issue-action-row .secondary-button,
  .issue-action-row .danger-button {
    width: 100%;
    min-height: 44px;
  }

  .table-wrap {
    margin: 0 -4px;
  }

  th,
  td {
    padding: 11px 10px;
    font-size: 12px;
  }

  .info-item,
  .mini-card,
  .compact-record {
    border-radius: 12px;
  }

  .result-grid {
    margin-top: 10px;
  }
}
