:root {
  --header-height: 72px;
  --bg: #070a12;
  --bg-soft: #0e1422;
  --panel: #101a2e;
  --panel-2: #17233b;
  --ink: #e9f2ff;
  --ink-soft: #9cb2d1;
  --brand: #2f8cff;
  --brand-2: #18c8b4;
  --danger: #ff5d73;
  --warning: #ffb34d;
  --success: #57da92;
  --border: #263553;
  --shadow: 0 18px 44px rgba(1, 5, 16, 0.45);
}

* {
  box-sizing: border-box;
}

img,
video,
canvas,
svg {
  max-width: 100%;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: var(--header-height);
  overflow-x: hidden;
  color: var(--ink);
  font-family: Manrope, sans-serif;
  background:
    radial-gradient(circle at 0% -20%, #1a2c58 0%, transparent 50%),
    radial-gradient(circle at 100% 0%, #053a45 0%, transparent 42%),
    linear-gradient(155deg, #05070e 0%, #0b1120 45%, #070a12 100%);
  line-height: 1.5;
}

h1,
h2,
h3,
.brand {
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: 0.2px;
}

a {
  color: #8bc3ff;
}

a:hover {
  color: #b9dbff;
}

.site-header {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  min-height: var(--header-height);
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px;
  border-bottom: 1px solid rgba(151, 180, 225, 0.18);
  background: rgba(9, 14, 26, 0.78);
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #f1f6ff;
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: 700;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: block;
  box-shadow: 0 0 0 2px rgba(47, 140, 255, 0.28), 0 8px 18px rgba(3, 10, 24, 0.35);
}

.user-menu {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.lang-select {
  min-height: 38px;
  border-radius: 9px;
  border: 1px solid rgba(126, 158, 206, 0.42);
  background: rgba(10, 23, 43, 0.85);
  color: #d2e5ff;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 8px 30px 8px 10px;
  min-width: 132px;
}

.lang-select:focus {
  outline: 2px solid rgba(47, 140, 255, 0.45);
  outline-offset: 1px;
}

.user-name {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-soft);
  font-weight: 700;
}

.avatar-button {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #4fb3ff;
  box-shadow: 0 0 0 3px rgba(79, 179, 255, 0.16);
}

.dropdown {
  position: absolute;
  right: 0;
  top: 58px;
  min-width: 220px;
  background: rgba(16, 26, 46, 0.98);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: none;
  overflow: hidden;
}

.dropdown.open {
  display: block;
}

.dropdown a,
.dropdown button {
  display: block;
  width: 100%;
  border: none;
  border-radius: 0;
  padding: 12px 14px;
  background: transparent;
  text-align: left;
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
  font-weight: 600;
}

.dropdown a:hover,
.dropdown button:hover {
  background: #1e2d4a;
}

.page-shell,
.auth-shell {
  margin: 26px auto;
  padding: 0 clamp(12px, 2.1vw, 24px) 36px;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.page-shell {
  width: min(100%, 1480px);
}

.auth-shell {
  width: min(100%, 520px);
  min-height: calc(100vh - var(--header-height));
  margin: 0 auto;
  padding: 24px 16px 36px;
  justify-content: center;
}

.page-shell > *,
.auth-shell > * {
  width: 100%;
}

.auth-card,
.panel,
.tab-panel,
.service-card {
  background: linear-gradient(165deg, rgba(22, 35, 59, 0.92), rgba(13, 22, 39, 0.95));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.panel,
.tab-panel {
  margin-bottom: 16px;
}

.auth-card h1,
.panel h1,
.panel h2,
.tab-panel h1,
.tab-panel h2 {
  margin-top: 0;
}

.stack-form {
  display: grid;
  gap: 10px;
}

label {
  color: var(--ink-soft);
  font-weight: 600;
}

input,
select,
button,
a.button {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  font: inherit;
  min-height: 44px;
}

input,
select {
  background: #0b1528;
  color: var(--ink);
}

input::placeholder {
  color: #6d83a7;
}

input:focus,
select:focus,
button:focus,
a:focus {
  outline: 2px solid rgba(47, 140, 255, 0.35);
  outline-offset: 1px;
}

button,
a.button {
  border: none;
  background: linear-gradient(120deg, var(--brand), var(--brand-2));
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease;
}

button:hover,
a.button:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

button.secondary {
  background: linear-gradient(120deg, #5f6f92, #6d8ec4);
}

button.danger {
  background: linear-gradient(120deg, #ff567a, #da385d);
}

button.warning {
  background: linear-gradient(120deg, #f5a53a, #d07a09);
}

.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  padding: 6px;
  border-radius: 14px;
  background: rgba(13, 21, 39, 0.75);
  border: 1px solid var(--border);
}

.tab-button {
  background: #1b2a45;
  color: #cfe4ff;
  border: 1px solid transparent;
}

.tab-button.is-active {
  background: linear-gradient(120deg, var(--brand), var(--brand-2));
  color: #fff;
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
  animation: enter 300ms ease;
}

.admin-tab-panel {
  display: none;
}

.admin-tab-panel.is-active {
  display: block;
  animation: enter 300ms ease;
}

.settings-tab-panel {
  display: none;
}

.settings-tab-panel.is-active {
  display: block;
  animation: enter 300ms ease;
}

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

.overview-grid,
.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.overview-grid article,
.service-card {
  background: linear-gradient(165deg, rgba(31, 47, 75, 0.9), rgba(16, 26, 46, 0.94));
  border: 1px solid rgba(127, 157, 209, 0.24);
  border-radius: 14px;
  padding: 16px;
}

.price {
  font-size: 1.3rem;
  color: #9ad0ff;
  font-weight: 800;
  margin: 10px 0;
}

.inline-form {
  margin-bottom: 10px;
}

.orders-table-wrap,
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid rgba(127, 157, 209, 0.2);
  border-radius: 12px;
}

.orders-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.orders-table thead {
  background: #111d34;
}

.orders-table th,
.orders-table td {
  border-bottom: 1px solid rgba(127, 157, 209, 0.2);
  padding: 12px;
  text-align: left;
}

.orders-table td {
  color: #dbe8ff;
}

.orders-table tr:hover td {
  background: rgba(38, 58, 93, 0.3);
}

.admin-inline {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.admin-inline input,
.admin-inline select {
  min-width: 140px;
  flex: 1;
}

.flash {
  padding: 11px 13px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-weight: 700;
  border: 1px solid transparent;
}

.flash-success {
  background: rgba(42, 120, 86, 0.26);
  border-color: rgba(94, 218, 156, 0.5);
  color: #b7ffd9;
}

.flash-error {
  background: rgba(135, 24, 48, 0.22);
  border-color: rgba(255, 97, 129, 0.45);
  color: #ffd3dc;
}

.flash-warning {
  background: rgba(124, 73, 10, 0.24);
  border-color: rgba(255, 180, 78, 0.45);
  color: #ffe6b8;
}

.announcement-tray {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 950;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 20px));
}

.announcement-toast {
  position: relative;
  background: linear-gradient(165deg, rgba(36, 53, 87, 0.96), rgba(17, 28, 49, 0.98));
  border: 1px solid rgba(112, 166, 238, 0.42);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
  animation: toastIn 250ms ease;
}

.announcement-toast h4 {
  margin: 0 24px 6px 0;
}

.announcement-toast p {
  margin: 0;
  color: #d4e6ff;
}

.system-toast {
  position: relative;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
  border: 1px solid transparent;
  animation: toastIn 250ms ease;
}

.system-toast h4 {
  margin: 0 24px 5px 0;
}

.system-toast p {
  margin: 0;
}

.system-toast-success {
  background: linear-gradient(165deg, rgba(26, 82, 73, 0.96), rgba(15, 61, 49, 0.96));
  border-color: rgba(104, 227, 176, 0.45);
  color: #d4ffe8;
}

.system-toast-error {
  background: linear-gradient(165deg, rgba(101, 23, 47, 0.96), rgba(74, 14, 33, 0.96));
  border-color: rgba(255, 123, 153, 0.45);
  color: #ffe3ea;
}

.system-toast-warning {
  background: linear-gradient(165deg, rgba(95, 63, 19, 0.96), rgba(74, 45, 11, 0.96));
  border-color: rgba(255, 189, 92, 0.45);
  color: #fff0ce;
}

.announcement-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border: 1px solid rgba(122, 162, 225, 0.4);
  background: rgba(18, 30, 52, 0.8);
  color: #d6e8ff;
  line-height: 1;
  padding: 0;
}

.announcement-close:hover {
  background: rgba(45, 65, 102, 0.95);
}

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

.auth-links {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.restriction-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(2, 6, 14, 0.84);
  display: grid;
  place-items: center;
  pointer-events: all;
}

.restriction-card {
  width: min(560px, 92vw);
  background: linear-gradient(165deg, rgba(26, 37, 61, 0.98), rgba(13, 21, 38, 0.98));
  border: 1px solid rgba(130, 160, 214, 0.26);
  color: var(--ink);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow);
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-avatar {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(127, 157, 209, 0.45);
}

.user-cell-name {
  font-weight: 700;
}

.announcement-history {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.announcement-item {
  border: 1px solid rgba(127, 157, 209, 0.24);
  background: rgba(18, 30, 52, 0.72);
  border-radius: 10px;
  padding: 12px;
}

.announcement-item h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.announcement-item p {
  margin: 0 0 4px;
}

.announcement-item small {
  color: var(--ink-soft);
}

.admin-tab-panel[data-admin-panel="email-logs"] .orders-table td[data-label="Details"] {
  word-break: break-word;
}

.profile-preview-wrap {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 8px;
}

.profile-preview {
  width: 92px;
  height: 92px;
  border-radius: 999px;
  object-fit: cover;
  border: 2px solid rgba(127, 157, 209, 0.5);
  box-shadow: 0 0 0 4px rgba(27, 48, 81, 0.8);
}

.settings-panel {
  max-width: 900px;
  margin-inline: auto;
}

.settings-form {
  gap: 11px;
}

.settings-form h3 {
  margin: 10px 0 2px;
}

.settings-tab-panel[data-settings-panel="activity"] td[data-label="Details"] {
  word-break: break-word;
}

.settings-form input,
.settings-form .custom-select-toggle,
.settings-form .custom-select-menu {
  width: 100%;
}

.settings-form input[type="file"] {
  padding: 10px;
  min-height: 42px;
}

.custom-select-toggle [data-select-label] {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: calc(100% - 24px);
}

.custom-select {
  position: relative;
}

.custom-select-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0b1528;
  border: 1px solid var(--border);
  color: var(--ink);
}

.custom-select-arrow {
  font-size: 0.82rem;
  opacity: 0.9;
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: min(260px, 42vh);
  overflow-y: auto;
  background: #12203b;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 6px;
  display: none;
  z-index: 30;
}

.custom-select.is-open .custom-select-menu {
  display: grid;
  gap: 4px;
}

.custom-select-option {
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
}

.custom-select-option:hover {
  background: rgba(60, 94, 150, 0.32);
}

.site-footer {
  margin-top: auto;
  border-top: 1px solid rgba(151, 180, 225, 0.18);
  background: rgba(6, 10, 18, 0.84);
}

.site-footer-inner {
  width: min(100%, 1480px);
  margin: 0 auto;
  padding: 16px clamp(12px, 2.1vw, 24px);
  color: var(--ink-soft);
  font-size: 0.93rem;
}

.site-footer-inner p {
  margin: 4px 0;
}

@media (max-width: 1100px) {
  .page-shell {
    width: 100%;
  }

  .orders-table {
    min-width: 620px;
  }
}

@media (max-width: 900px) {
  :root {
    --header-height: 68px;
  }

  .site-header {
    padding: 12px 14px;
  }

  .brand {
    font-size: 1.1rem;
  }

  .user-name {
    max-width: 140px;
  }

  .tabs {
    overflow-x: auto;
    white-space: nowrap;
  }

  .settings-panel {
    max-width: 100%;
  }

  .settings-form {
    gap: 10px;
  }

  .admin-tab-panel[data-admin-panel="users"] .orders-table td[data-label="Actions"] {
    min-width: 0;
  }

  .admin-tab-panel[data-admin-panel="users"] .admin-inline {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 12px;
  }

  .admin-tab-panel[data-admin-panel="users"] .admin-inline input,
  .admin-tab-panel[data-admin-panel="users"] .admin-inline select,
  .admin-tab-panel[data-admin-panel="users"] .admin-inline button {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 760px) {
  :root {
    --header-height: 64px;
  }

  .site-header {
    padding: 12px 14px;
  }

  .user-name {
    max-width: 120px;
  }

  .admin-inline {
    flex-direction: column;
    align-items: stretch;
  }

  .tabs {
    flex-direction: column;
  }

  .tab-button {
    width: 100%;
  }

  .auth-shell {
    padding-top: 12px;
    justify-content: flex-start;
  }

  .auth-card,
  .panel,
  .tab-panel,
  .service-card {
    padding: 16px;
  }

  .settings-form h3 {
    margin-top: 12px;
  }

  .settings-form input,
  .settings-form .custom-select-toggle,
  .settings-form button,
  .settings-form select {
    font-size: 16px;
  }

  .orders-table {
    min-width: 560px;
  }

  .orders-table-wrap,
  .table-wrap {
    border: none;
    overflow: visible;
  }

  .orders-table {
    min-width: 0;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
  }

  .orders-table thead {
    display: none;
  }

  .orders-table tbody,
  .orders-table tr,
  .orders-table td {
    display: block;
    width: 100%;
  }

  .orders-table tr {
    border: 1px solid rgba(127, 157, 209, 0.22);
    border-radius: 12px;
    background: rgba(17, 28, 48, 0.78);
    overflow: hidden;
  }

  .orders-table td {
    border-bottom: 1px solid rgba(127, 157, 209, 0.16);
    padding: 10px 12px;
  }

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

  .orders-table td::before {
    content: attr(data-label);
    display: block;
    color: var(--ink-soft);
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
  }

  .admin-inline {
    margin-bottom: 10px;
  }

  .custom-select-menu {
    position: static;
    margin-top: 6px;
    max-height: 36vh;
  }

  .announcement-tray {
    right: 10px;
    width: min(360px, calc(100vw - 12px));
  }
}

@media (max-width: 480px) {
  .brand {
    font-size: 1rem;
  }

  .user-name {
    display: none;
  }

  .dropdown {
    min-width: 170px;
  }

  .overview-grid,
  .service-grid {
    grid-template-columns: 1fr;
  }

  .site-footer-inner {
    font-size: 0.86rem;
  }

  .settings-form {
    gap: 9px;
  }

  .custom-select-toggle [data-select-label] {
    white-space: normal;
    max-width: 100%;
  }
}
