.muted {
  color: var(--text-soft);
}

.top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.page-actions,
.admin-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(20, 27, 15, 0.95);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #475438;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid #39452c;
  text-align: left;
  vertical-align: top;
}

th {
  background: linear-gradient(180deg, #364226 0%, #29331d 100%);
  color: #e9efdc;
}

td {
  color: #dfe7d0;
  word-break: break-word;
}

tr:hover {
  background: rgba(118, 135, 79, 0.08);
}

.action-btn:disabled,
.small-btn:disabled,
.green-btn:disabled {
  background: #3e4636;
  color: #98a08e;
  cursor: not-allowed;
}

.reset-btn {
  background: var(--danger);
  color: white;
}

.reset-btn:hover {
  background: var(--danger-hover);
}

.green-btn {
  background: var(--green);
  color: white;
  padding: 10px 14px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: bold;
  transition: 0.2s ease;
  min-height: 44px;
}

.green-btn:hover {
  background: var(--green-hover);
}

.status-taken {
  color: #9ed36a;
  font-weight: bold;
}

.status-pending {
  color: #d7c56d;
  font-weight: bold;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.admin-box {
  background: rgba(16, 22, 12, 0.75);
  border: 1px solid #465338;
  border-radius: 12px;
  padding: 16px;
}

.empty-state {
  color: var(--text-soft);
  text-align: center;
  padding: 16px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 8, 0.85);
  backdrop-filter: blur(4px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: var(--bg-panel);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 20px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.4);
}

.modal-card h3 {
  margin-bottom: 10px;
  color: #f3f7e8;
}

.modal-actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  justify-content: center;
}

.modal-actions button {
  flex: 1;
}

.bottom-nav {
  display: none;
}

.app-toast-region {
  position: fixed;
  inset-inline-end: 16px;
  bottom: calc(var(--bottom-nav-height) + 18px);
  z-index: 2500;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100vw - 24px));
  pointer-events: none;
}

.app-toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(210, 229, 154, 0.16);
  background: rgba(12, 19, 10, 0.9);
  color: #eef4e4;
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px);
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: auto;
}

.app-toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.app-toast.is-leaving {
  opacity: 0;
  transform: translateY(6px) scale(0.98);
}

.app-toast-info {
  border-color: rgba(177, 214, 94, 0.18);
}

.app-toast-success {
  border-color: rgba(141, 203, 94, 0.32);
}

.app-toast-error {
  border-color: rgba(196, 96, 96, 0.28);
}

.app-toast-text {
  flex: 1;
  font-size: 14px;
  line-height: 1.45;
}

.app-toast-close {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.78;
  padding: 0;
  min-width: 20px;
}


/* Desktop collapsible sidebar */
@media (min-width: 901px) {
  .sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
    min-width: var(--sidebar-collapsed-width);
    padding: 18px 10px;
  }

  .sidebar.collapsed .sidebar-header {
    display: none;
  }

  .sidebar.collapsed .side-link {
    justify-content: center;
    padding: 14px 10px;
  }

  .sidebar.collapsed .side-text {
    display: none;
  }

  .sidebar.collapsed .nav-unread-badge {
    position: absolute;
    top: 8px;
    inset-inline-end: 8px;
    margin-inline-start: 0;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 10px;
  }
}

/* Tablet and below */
@media (max-width: 900px) {
  body.sidebar-open-mobile {
    overflow: hidden;
  }

  .topbar {
    padding: 0 14px;
  }

  .sidebar-backdrop {
    top: var(--topbar-current-height, var(--topbar-height));
  }

  .sidebar {
    position: fixed;
    top: var(--topbar-current-height, var(--topbar-height));
    left: 0;
    right: auto;
    height: calc(100dvh - var(--topbar-current-height, var(--topbar-height)));
    padding-top: 4px;
    padding-bottom: calc(var(--bottom-nav-height) + 28px + env(safe-area-inset-bottom));
    z-index: 1050;
    transform: translateX(-100%);
    box-shadow: 12px 0 34px rgba(0, 0, 0, 0.28);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  html[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
    transform: translateX(100%);
    box-shadow: -12px 0 34px rgba(0, 0, 0, 0.28);
  }

  html[dir="rtl"] .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    width: 100%;
    padding: 16px 14px 90px;
  }

  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--bottom-nav-height);
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: rgba(19, 27, 15, 0.74);
    border-top: 1px solid rgba(210, 229, 154, 0.14);
    backdrop-filter: blur(16px) saturate(1.06);
    z-index: 1080;
  }

  .bottom-nav-link {
    position: relative;
    border: 1px solid var(--nav-item-border);
    background: linear-gradient(180deg, var(--nav-item-bg), rgba(255, 255, 255, 0.015));
    color: #dfe7d0;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    min-height: 58px;
    padding: 8px 8px;
    opacity: var(--nav-inactive-opacity);
    box-shadow:
      var(--nav-item-shadow),
      var(--nav-item-inner);
    transition: transform 0.25s ease, background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
  }

  .bottom-nav-link::before {
    content: "";
    position: absolute;
    inset-inline-start: 6px;
    top: 9px;
    bottom: 9px;
    width: 3px;
    border-radius: 999px;
    background: var(--nav-indicator);
    opacity: 0;
    transform: scaleY(0.4);
    transition: opacity 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
  }

  .bottom-nav-icon {
    width: 19px;
    height: 19px;
    line-height: 1;
    font-size: 17px;
  }

  .bottom-nav-icon svg {
    width: 100%;
    height: 100%;
  }

  .bottom-nav-text {
    font-size: 12px;
    font-weight: 700;
  }

  .bottom-nav-link:hover,
  .bottom-nav-link:active {
    transform: translateX(2px) scale(1.02);
    opacity: 1;
    box-shadow:
      var(--nav-item-shadow-hover),
      0 0 16px rgba(125, 177, 72, 0.08),
      inset 0 1px 0 rgba(255, 255, 255, 0.06);
  }

  .bottom-nav-link.active-link::before {
    opacity: 1;
    transform: scaleY(1);
    box-shadow: 0 0 12px rgba(145, 215, 78, 0.35);
  }

  .bottom-nav-link.active-link {
    opacity: 1;
  }

  .bottom-nav-link .nav-unread-badge {
    position: absolute;
    top: 7px;
    inset-inline-end: 7px;
    min-width: 17px;
    height: 17px;
    padding: 0 5px;
    margin-inline-start: 0;
    font-size: 10px;
  }

  .app-toast-region {
    inset-inline: 12px;
    width: auto;
    bottom: calc(var(--bottom-nav-height) + 12px + env(safe-area-inset-bottom));
  }
}

/* General mobile */
@media (max-width: 768px) {
  .topbar {
    height: auto;
    min-height: var(--topbar-height);
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
    gap: 10px;
  }

  html[data-theme="dark"] .topbar {
    background:
      linear-gradient(180deg, rgba(7, 11, 7, 0.84), rgba(10, 15, 9, 0.7)),
      linear-gradient(90deg, rgba(6, 9, 6, 0.38), rgba(6, 9, 6, 0.12)),
      var(--camo-image),
      var(--panel-soft);
    background-size: auto, auto, 920px 620px, auto;
    background-position: center, center, center top, center;
  }

  .topbar-left {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    order: 2;
  }

  .auth-header {
    width: 100%;
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    grid-template-areas:
      "language theme user"
      "logout logout logout";
    align-items: center;
    gap: 8px;
    order: 1;
  }

  .user-meta {
    width: min(100%, 100%);
    max-width: min(58vw, 240px);
    min-width: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    grid-area: user;
    justify-self: end;
  }

  #languageToggleBtn {
    grid-area: language;
    justify-self: start;
  }

  #themeToggleBtn {
    grid-area: theme;
    justify-self: start;
  }

  .user-box-header {
    width: 100%;
    grid-area: logout;
    display: flex;
    justify-content: flex-start;
    margin-top: 0;
  }

  .user-email {
    max-width: 100%;
    min-width: 0;
    white-space: nowrap;
    word-break: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: start;
  }

  .role-badge {
    flex-shrink: 0;
    margin: 0;
    white-space: nowrap;
    padding: 4px 9px;
    font-size: 11px;
  }

  .topbar-avatar {
    margin: 0 !important;
    width: 34px;
    height: 34px;
    font-size: 12px;
  }

  .brand {
    font-size: 19px;
    min-width: 0;
    max-width: calc(100% - 60px);
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .main-content {
    padding: 12px 12px 92px;
  }

  .card {
    padding: 16px;
    border-radius: 14px;
  }

  .hero-card {
    min-height: 140px;
  }

  .page-actions,
  .admin-actions,
  .modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .page-actions > *,
  .admin-actions > *,
  .modal-actions > * {
    width: 100%;
  }

  .admin-search {
    min-width: 100%;
  }

  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
  }

  thead {
    display: none;
  }

  tr {
    margin-bottom: 12px;
    border: 1px solid #475438;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(20, 27, 15, 0.95);
  }

  td {
    border-bottom: 1px solid #39452c;
    padding: 12px;
  }

  td:last-child {
    border-bottom: none;
  }

  td::before {
    content: attr(data-label);
    display: block;
    font-weight: bold;
    color: #c7d7a3;
    margin-bottom: 6px;
  }

  .sidebar-header {
    position: relative;
    top: auto;
    z-index: auto;
    margin: 0 0 8px;
    padding: 4px 12px 4px;
    background: linear-gradient(180deg, rgba(16, 21, 12, 0.94), rgba(16, 21, 12, 0.82));
    backdrop-filter: blur(12px);
  }

  html[data-theme="light"] .sidebar-header {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.52), rgba(247, 244, 237, 0.36));
    color: rgba(70, 80, 67, 0.92) !important;
    border-radius: 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(10px);
  }

  html[data-theme="light"][dir="rtl"] .sidebar-header,
  html[dir="rtl"] .sidebar-header {
    font-size: 20px !important;
    letter-spacing: 0 !important;
    font-weight: 900 !important;
    line-height: 1.2;
  }

  html[dir="rtl"] .auth-header {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "user theme language"
      "logout logout logout";
  }

  html[dir="rtl"] .user-meta {
    justify-self: start;
  }

  html[dir="rtl"] .user-email {
    text-align: right;
  }

  html[dir="rtl"] #languageToggleBtn,
  html[dir="rtl"] #themeToggleBtn {
    justify-self: end;
  }

  html[dir="rtl"] .user-box-header {
    justify-content: flex-end;
  }

  html[dir="rtl"] .brand {
    text-align: right;
  }

  html[data-theme="dark"] #languageToggleBtn,
  html[data-theme="dark"] #themeToggleBtn,
  html[data-theme="dark"] .menu-toggle,
  html[data-theme="dark"] .user-box-header button {
    background: rgba(12, 18, 11, 0.74) !important;
    border-color: rgba(210, 229, 154, 0.2) !important;
    color: #f2f6ea !important;
    box-shadow:
      0 8px 18px rgba(0, 0, 0, 0.18),
      inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(12px);
  }

  html[data-theme="dark"] .user-meta {
    background: rgba(9, 14, 9, 0.5);
    border: 1px solid rgba(210, 229, 154, 0.12);
    border-radius: 18px;
    padding: 4px 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  }

  html[data-theme="dark"] .user-email,
  html[data-theme="dark"] .role-badge,
  html[data-theme="dark"] .brand {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.42);
  }

}

/* Small phones */
@media (max-width: 480px) {
  .login-page {
    padding: 16px;
  }

  .login-card {
    padding: 22px 18px;
  }

  .loader-card {
    min-width: unset;
    width: calc(100% - 32px);
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 20px;
  }

  .menu-toggle {
    padding: 10px 12px;
  }

  .bottom-nav-text {
    font-size: 11px;
  }
}
