/* ========================================================
   SMKN 2 PURWOKERTO - ADMIN CMS STYLESHEET
   ======================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  --sidebar-width: 260px;
  --header-height: 68px;

  --admin-bg: #0f172a;
  --admin-card: #1e293b;
  --admin-card-header: #283548;
  --admin-border: #334155;
  --sidebar-bg: #090d16;
  --header-bg: #090d16;

  --primary: #0284c7;
  --primary-hover: #0369a1;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --info: #06b6d4;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dark: #1e293b;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --font: 'Plus Jakarta Sans', system-ui, sans-serif;
}

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

body {
  font-family: var(--font);
  background-color: var(--admin-bg);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  transition: background-color 0.25s ease, color 0.25s ease;
}

a {
  color: var(--primary);
  text-decoration: none;
}

/* Sidebar */
.admin-sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--admin-border);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s ease;
}

.sidebar-header {
  padding: 1.25rem 1.25rem;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: var(--header-height);
  box-sizing: border-box;
}

.sidebar-logo {
  height: 36px;
  width: 36px;
  flex-shrink: 0;
  object-fit: contain;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity 0.2s ease, width 0.2s ease;
  white-space: nowrap;
}

.sidebar-title {
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}

.sidebar-badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  background: var(--primary);
  border-radius: 4px;
  font-weight: 700;
  display: inline-block;
  margin-top: 2px;
  width: fit-content;
}

.sidebar-menu {
  padding: 1rem 0;
  flex-grow: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.menu-label {
  padding: 0.75rem 1.5rem 0.35rem 1.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #64748b;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1.5rem;
  color: #94a3b8;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  white-space: nowrap;
  position: relative;
  text-decoration: none;
}

.menu-item:hover,
.menu-item.active {
  background: rgba(2, 132, 199, 0.15);
  color: #38bdf8;
  border-left: 4px solid var(--primary);
}

.menu-item i {
  font-size: 1.15rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.menu-text {
  transition: opacity 0.2s ease;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-badge {
  margin-left: auto;
  transition: opacity 0.2s ease;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-footer .btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  transition: all 0.2s ease;
}

/* Main Content Area */
.admin-main {
  margin-left: var(--sidebar-width);
  flex-grow: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: calc(100% - var(--sidebar-width));
}

.admin-header {
  height: var(--header-height);
  background: var(--header-bg);
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  position: sticky;
  top: 0;
  z-index: 90;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}



/* White Hamburger Toggle Button matching user mockup */
.btn-sidebar-toggle {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.15rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
}

.btn-sidebar-toggle:hover {
  background: #f8fafc;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  color: var(--primary);
}

.btn-sidebar-toggle:active {
  transform: translateY(0);
}

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

.header-user-menu {
  position: relative;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0.75rem;
  border-radius: 10px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--admin-border);
  transition: all 0.2s ease;
  user-select: none;
}

.header-user:hover {
  background: rgba(2, 132, 199, 0.15);
  border-color: var(--primary);
}

.user-dropdown-arrow {
  transition: transform 0.2s ease;
}

.header-user-menu.active .user-dropdown-arrow {
  transform: rotate(180deg);
}

.user-dropdown-card {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 260px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 14px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
  display: none;
  z-index: 9999;
  overflow: hidden;
  animation: fadeInDown 0.2s ease;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.header-user-menu.active .user-dropdown-card {
  display: block !important;
}

.user-dropdown-header {
  padding: 1rem 1.15rem;
  border-bottom: 1px solid #334155;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.9));
}

.user-dropdown-body {
  padding: 0.5rem;
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
}

.user-dropdown-item {
  display: flex !important;
  align-items: center !important;
  gap: 0.75rem !important;
  padding: 0.6rem 0.85rem !important;
  color: #cbd5e1 !important;
  font-size: 0.875rem !important;
  font-weight: 500 !important;
  border-radius: 8px !important;
  transition: all 0.2s ease !important;
  text-decoration: none !important;
}

.user-dropdown-item:hover {
  background: rgba(2, 132, 199, 0.18) !important;
  color: #38bdf8 !important;
  transform: translateX(3px);
}

.user-dropdown-item.logout-link {
  color: #f87171 !important;
  font-weight: 600 !important;
  background: rgba(239, 68, 68, 0.08) !important;
  border: 1px solid rgba(239, 68, 68, 0.2) !important;
  margin-top: 2px;
}

.user-dropdown-item.logout-link:hover {
  background: #ef4444 !important;
  color: #ffffff !important;
  border-color: #ef4444 !important;
  transform: translateX(0);
}

/* Collapsed Sidebar State (Kanan-Kiri Collapse) */
body.sidebar-collapsed .admin-sidebar {
  width: 72px;
}

body.sidebar-collapsed .admin-main {
  margin-left: 72px;
  width: calc(100% - 72px);
}

body.sidebar-collapsed .sidebar-header {
  justify-content: center;
  padding: 1.25rem 0.5rem;
}

body.sidebar-collapsed .sidebar-brand-text,
body.sidebar-collapsed .menu-label,
body.sidebar-collapsed .menu-text,
body.sidebar-collapsed .menu-badge,
body.sidebar-collapsed .sidebar-footer .btn-logout span {
  display: none !important;
  opacity: 0;
}

body.sidebar-collapsed .menu-item {
  justify-content: center;
  padding: 0.85rem 0;
  border-left: 4px solid transparent;
}

body.sidebar-collapsed .menu-item i {
  font-size: 1.35rem;
  margin: 0;
}

body.sidebar-collapsed .sidebar-footer {
  padding: 1rem 0.5rem;
}

body.sidebar-collapsed .sidebar-footer .btn-logout {
  width: 44px !important;
  height: 40px;
  padding: 0;
  border-radius: 8px;
}

body.sidebar-collapsed .sidebar-footer .btn-logout i {
  font-size: 1.1rem;
}

/* Responsive Drawer & Overlay */
.sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 95;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

body.sidebar-mobile-open .sidebar-backdrop {
  opacity: 1;
  visibility: visible;
}

.sidebar-close-btn {
  display: none;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.35rem;
  margin-left: auto;
  border-radius: 6px;
  transition: all 0.2s ease;
  line-height: 1;
}

.sidebar-close-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* Responsive queries */
@media (max-width: 992px) {
  .admin-sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    z-index: 100;
  }

  .sidebar-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .admin-main {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  body.sidebar-mobile-open .admin-sidebar {
    transform: translateX(0);
  }

  body.sidebar-collapsed .admin-sidebar {
    transform: translateX(-100%);
  }

  body.sidebar-collapsed.sidebar-mobile-open .admin-sidebar {
    transform: translateX(0);
  }

  body.sidebar-mobile-open {
    overflow: hidden !important;
  }
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.admin-body {
  padding: 2rem;
  flex-grow: 1;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.page-title-box {
  margin-bottom: 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 800;
}

/* Dashboard Metric Cards */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  box-shadow: var(--shadow);
}

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.bg-blue {
  background: rgba(2, 132, 199, 0.2);
  color: #38bdf8;
}

.bg-green {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.bg-amber {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.bg-purple {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
}

.metric-val {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.2;
}

.metric-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Content Cards & Data Tables */
.admin-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  margin-bottom: 1.75rem;
  overflow: hidden;
  max-width: 100%;
}

.admin-card-header {
  padding: 1rem 1.5rem;
  background: var(--admin-card-header);
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.admin-card-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.admin-card-body {
  padding: 1.5rem;
  max-width: 100%;
  box-sizing: border-box;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
  border-radius: var(--radius-sm);
}

.table,
.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.table th,
.table td,
.admin-table th,
.admin-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--admin-border);
  vertical-align: middle;
}

.table th,
.admin-table th {
  background: rgba(15, 23, 42, 0.5);
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

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

.table-sm th,
.table-sm td {
  padding: 0.35rem 0.45rem !important;
  font-size: 0.76rem !important;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 4px;
  white-space: nowrap;
}

.badge-success {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.badge-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.badge-info {
  background: rgba(6, 182, 212, 0.2);
  color: #38bdf8;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: #cbd5e1;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--admin-border);
  background: #090d16;
  color: #fff;
  font-family: inherit;
  font-size: 0.9rem;
  box-sizing: border-box;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.25);
}

/* Alert Boxes */
.alert {
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  word-break: break-word;
}

.alert-success {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid #10b981;
  color: #34d399;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid #ef4444;
  color: #f87171;
}

/* Action Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.775rem;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-secondary {
  background: #334155;
  color: #fff;
}

.btn-secondary:hover {
  background: #475569;
}

.btn-info {
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.5);
  color: #38bdf8;
}

.btn-info:hover {
  background: rgba(56, 189, 248, 0.35);
  color: #fff;
}

.btn-warning {
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: #fbbf24;
}

.btn-warning:hover {
  background: rgba(245, 158, 11, 0.35);
  color: #fff;
}

.btn-outline-primary {
  background: transparent;
  border: 1px solid var(--primary);
  color: #38bdf8;
}

.btn-outline-primary:hover {
  background: var(--primary);
  color: #fff;
}

.btn-outline-secondary {
  background: transparent;
  border: 1px solid #475569;
  color: #cbd5e1;
}

.btn-outline-secondary:hover {
  background: #334155;
  color: #fff;
}

.btn-outline-info {
  background: transparent;
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

.btn-outline-info:hover {
  background: rgba(56, 189, 248, 0.15);
  color: #fff;
}

/* Login Container */
.login-body {
  background: radial-gradient(circle at center, #1e293b 0%, #090d16 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo {
  height: 48px;
  margin-bottom: 1rem;
}

/* ========================================================
   COMPREHENSIVE MOBILE RESPONSIVE ADAPTATIONS (HP & TABLET)
   ======================================================== */

@media (max-width: 992px) {
  .admin-header {
    padding: 0 1.25rem;
  }

  .admin-sidebar {
    transform: translateX(-100%);
    width: 280px !important;
    max-width: 85vw !important;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.6);
    z-index: 1000;
  }

  .sidebar-close-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }

  .admin-main {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  body.sidebar-mobile-open .admin-sidebar {
    transform: translateX(0);
  }

  body.sidebar-collapsed .admin-sidebar {
    transform: translateX(-100%);
  }

  body.sidebar-collapsed.sidebar-mobile-open .admin-sidebar {
    transform: translateX(0);
  }

  body.sidebar-mobile-open {
    overflow: hidden !important;
  }
}

@media (max-width: 768px) {

  html,
  body {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  .admin-header {
    padding: 0 0.85rem !important;
    height: 58px !important;
  }

  .header-left {
    gap: 0.75rem !important;
  }

  .header-left .header-date {
    display: none !important;
  }

  .btn-sidebar-toggle {
    width: 36px !important;
    height: 36px !important;
    font-size: 1rem !important;
    border-radius: 6px !important;
  }

  .admin-body {
    padding: 0.85rem 0.65rem !important;
  }

  .page-title-box {
    margin-bottom: 1rem !important;
    gap: 0.5rem !important;
    flex-direction: column !important;
    align-items: flex-start !important;
  }

  .page-title {
    font-size: 1.2rem !important;
    line-height: 1.3 !important;
  }

  .admin-card {
    border-radius: 10px !important;
    margin-bottom: 1rem !important;
  }

  .admin-card-header,
  .card-header {
    padding: 0.75rem 0.85rem !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.5rem !important;
  }

  .admin-card-body,
  .card-body {
    padding: 0.85rem !important;
  }

  /* Metric stats cards */
  .metric-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.65rem !important;
    margin-bottom: 1rem !important;
  }

  .metric-card {
    padding: 0.75rem !important;
    gap: 0.6rem !important;
  }

  .metric-icon {
    width: 36px !important;
    height: 36px !important;
    font-size: 1rem !important;
  }

  .metric-val {
    font-size: 1.2rem !important;
  }

  .metric-label {
    font-size: 0.7rem !important;
  }

  /* Universal Single Column Flow for Multi-column Layouts across Guru & Siswa */
  [style*="grid-template-columns: 1.2fr 1fr"],
  [style*="grid-template-columns: 1.15fr 1fr"],
  [style*="grid-template-columns: 1.1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns: 2fr 1fr"],
  [style*="grid-template-columns: 1fr 340px"],
  [style*="grid-template-columns: 1fr 360px"],
  [style*="grid-template-columns: 340px 1fr"],
  [style*="grid-template-columns: 300px 1fr"],
  [style*="grid-template-columns: 280px 1fr"],
  [style*="grid-template-columns: 1fr 1.35fr"],
  [style*="grid-template-columns: 2fr 1.2fr"],
  [style*="grid-template-columns: 1.35fr 1fr"],
  [style*="grid-template-columns: 1.5fr 1fr"],
  [style*="grid-template-columns: repeat(auto-fit, minmax(320px, 1fr))"],
  [style*="grid-template-columns: repeat(auto-fit, minmax(300px, 1fr))"],
  [style*="grid-template-columns: repeat(auto-fit, minmax(280px, 1fr))"],
  [style*="grid-template-columns: repeat(auto-fit, minmax(260px, 1fr))"],
  [style*="grid-template-columns: repeat(auto-fit, minmax(220px, 1fr))"] {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  /* Compact 2-column or 4-column subgrids */
  [style*="grid-template-columns: repeat(4, 1fr)"],
  [style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.45rem !important;
  }

  /* Presensi buttons 2 columns for Siswa */
  #formPresensiSiswa [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
  }

  /* Card action headers and filter bars */
  .card-header-action,
  .action-bar,
  .filter-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.5rem !important;
    width: 100% !important;
  }

  .card-header-action form,
  .action-bar form,
  .filter-row form {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
  }

  .card-header-action form input,
  .card-header-action form select,
  .card-header-action form button,
  .action-bar form input,
  .action-bar form select,
  .action-bar form button {
    width: 100% !important;
  }

  /* Responsive Data Tables */
  .table-responsive {
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    margin-bottom: 0.75rem !important;
    border-radius: var(--radius-sm) !important;
    display: block !important;
  }

  .table,
  .admin-table {
    min-width: 520px;
    font-size: 0.8rem !important;
  }

  .table th,
  .table td,
  .admin-table th,
  .admin-table td {
    padding: 0.55rem 0.65rem !important;
    font-size: 0.8rem !important;
  }

  /* Nav Tabs */
  .nav-tabs,
  .admin-tabs {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 4px !important;
    gap: 4px !important;
  }

  .nav-tab-item {
    white-space: nowrap !important;
    padding: 0.5rem 0.85rem !important;
    font-size: 0.82rem !important;
  }

  /* Forms & Touch Targets */
  .form-control,
  .form-select,
  input[type="text"],
  input[type="password"],
  input[type="email"],
  input[type="date"],
  select,
  textarea {
    font-size: 16px !important;
    min-height: 40px !important;
  }

  .btn {
    min-height: 40px !important;
    touch-action: manipulation;
  }
}

@media (max-width: 576px) {
  .admin-header {
    padding: 0 0.65rem !important;
  }

  .header-user {
    padding: 0.25rem 0.45rem !important;
  }

  .header-user .user-meta {
    display: none !important;
  }

  .user-dropdown-card {
    right: 0 !important;
    left: auto !important;
    width: min(280px, 92vw) !important;
    max-width: 92vw !important;
  }

  .admin-body {
    padding: 0.75rem 0.5rem !important;
  }

  .metric-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.45rem !important;
  }

  .metric-card {
    padding: 0.65rem 0.5rem !important;
  }

  .login-card {
    padding: 1.5rem 1.15rem !important;
  }

  .btn {
    padding: 0.5rem 0.85rem !important;
    font-size: 0.82rem !important;
  }

  .btn-sm {
    padding: 0.35rem 0.6rem !important;
    font-size: 0.75rem !important;
  }
}

@media (max-width: 400px) {
  .admin-body {
    padding: 0.65rem 0.35rem !important;
  }

  .page-title {
    font-size: 1.1rem !important;
  }

  .metric-grid {
    grid-template-columns: 1fr !important;
    gap: 0.45rem !important;
  }
}

/* ========================================================
   DATE & TIME INPUT - ORANGE / GREEN CALENDAR ICON
   ======================================================== */
input[type="date"],
input[type="datetime-local"],
input[type="month"],
input[type="time"] {
  color-scheme: dark;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='%23f59e0b' d='M19 4h-1V2h-2v2H8V2H6v2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V10h14v10zm0-12H5V6h14v2z'/%3E%3Ccircle cx='8' cy='14' r='1.5' fill='%23f59e0b'/%3E%3Ccircle cx='12' cy='14' r='1.5' fill='%23f59e0b'/%3E%3Ccircle cx='16' cy='14' r='1.5' fill='%23f59e0b'/%3E%3C/svg%3E") !important;
  background-position: center !important;
  background-size: 20px 20px !important;
  background-repeat: no-repeat !important;
  cursor: pointer !important;
  opacity: 1 !important;
  transition: all 0.2s ease;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
input[type="month"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='%2310b981' d='M19 4h-1V2h-2v2H8V2H6v2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V10h14v10zm0-12H5V6h14v2z'/%3E%3Ccircle cx='8' cy='14' r='1.5' fill='%2310b981'/%3E%3Ccircle cx='12' cy='14' r='1.5' fill='%2310b981'/%3E%3Ccircle cx='16' cy='14' r='1.5' fill='%2310b981'/%3E%3C/svg%3E") !important;
}