:root {
  --bg-900: #102033;
  --bg-800: #1a3450;
  --bg-700: #275074;
  --surface: #f4f7fb;
  --panel: #ffffff;
  --panel-strong: #fbfdff;
  --line: #d8e0ec;
  --line-strong: #bcc8d9;
  --text: #0f2238;
  --muted: #5f738b;
  --accent: #0f8d8a;
  --accent-dark: #0a6f6d;
  --warn: #b45309;
  --danger: #b42318;
  --success: #18794e;
  --radius-xl: 24px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --shadow-soft: 0 16px 40px rgba(16, 32, 51, 0.15);
  --shadow-card: 0 10px 26px rgba(16, 32, 51, 0.08);
  --sidebar-width: 260px;
  --sidebar-collapsed: 84px;
  --header-height: 76px;
  --ctl-h: 44px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: 'Raleway', 'Segoe UI', sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at -10% -10%, #31668c 0%, transparent 45%),
    radial-gradient(1000px 620px at 110% -20%, #1f8a85 0%, transparent 40%),
    linear-gradient(165deg, var(--bg-900) 0%, var(--bg-800) 45%, var(--bg-700) 100%);
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.header {
  height: var(--header-height);
  margin: 18px 18px 10px;
  padding: 0 20px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-xl);
  color: #f0f6ff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  backdrop-filter: blur(12px);
  background: linear-gradient(135deg, rgba(12, 26, 42, 0.88), rgba(17, 42, 62, 0.72));
  box-shadow: 0 14px 30px rgba(6, 13, 20, 0.25);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-title-wrap {
  display: grid;
  gap: 2px;
}

.app-title-kicker {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: #8eb4d8;
  font-weight: 700;
}

.app-title {
  font-weight: 800;
  font-size: 1.15rem;
  line-height: 1;
  letter-spacing: 0.02em;
}

.header-user {
  font-weight: 700;
  color: #cae0f8;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.header-user strong {
  color: #ffffff;
}

.header-user a,
.header-user button,
.link-logout {
  color: #d6eeff;
  text-decoration: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.header-user a:hover,
.header-user button:hover,
.link-logout:hover {
  color: #ffffff;
}

.toggle-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(162, 196, 229, 0.35);
  background: rgba(27, 63, 91, 0.55);
  color: #e9f4ff;
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.toggle-btn:hover {
  transform: translateY(-1px);
  background: rgba(44, 89, 124, 0.75);
}

.layout {
  display: flex;
  gap: 14px;
  margin: 0 18px 18px;
  min-height: calc(100vh - var(--header-height) - 46px);
}

.sidebar {
  width: var(--sidebar-width);
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(10px);
  background: linear-gradient(175deg, rgba(11, 25, 39, 0.85), rgba(17, 38, 57, 0.72));
  transition: width 0.24s ease;
  overflow: hidden;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar a {
  text-decoration: none;
  color: #c7dbf0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  font-weight: 700;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.sidebar a:hover {
  color: #ffffff;
  background: rgba(143, 190, 231, 0.16);
  transform: translateX(2px);
}

.sidebar a.active {
  color: #ffffff;
  background: linear-gradient(135deg, rgba(15, 141, 138, 0.82), rgba(37, 149, 206, 0.68));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.sidebar .icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  fill: currentColor;
}

.sidebar .side-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar.collapsed a {
  justify-content: center;
  position: relative;
  padding-inline: 0;
}

.sidebar.collapsed a .side-label {
  position: absolute;
  left: calc(var(--sidebar-collapsed) + 10px);
  top: 50%;
  transform: translateY(-50%);
  padding: 8px 10px;
  border-radius: 10px;
  color: #ffffff;
  background: rgba(15, 35, 55, 0.96);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  z-index: 20;
}

.sidebar.collapsed a:hover .side-label {
  opacity: 1;
}

.content {
  flex: 1;
  min-width: 0;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, #f8fbff, var(--surface));
  border: 1px solid rgba(157, 179, 203, 0.42);
  padding: 16px;
  box-shadow: var(--shadow-soft);
  animation: content-enter 0.5s ease;
}

.card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-card);
  padding: 18px;
}

.card-main {
  min-height: calc(100vh - 190px);
}

.pagehead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.pagehead h2 {
  margin: 0;
  color: #10243b;
  font-size: 1.45rem;
  letter-spacing: 0.01em;
}

.pagehead .sub {
  margin-top: 3px;
  color: var(--muted);
}

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

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--panel);
}

table th,
table td {
  padding: 11px 12px;
  border-bottom: 1px solid #e6edf7;
  text-align: left;
  vertical-align: middle;
}

table th {
  background: #eef4fb;
  color: #173253;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

table tr:hover td {
  background: #f6faff;
}

table tr:last-child td {
  border-bottom: 0;
}

th:last-child,
td:last-child {
  width: 136px;
  text-align: right;
}

th a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

th a:hover {
  color: #0e5d8e;
}

.sort-icon {
  font-size: 0.72rem;
  opacity: 0.65;
}

.sort-active {
  opacity: 1;
}

.row-actions {
  display: inline-flex;
  gap: 6px;
  justify-content: flex-end;
  white-space: nowrap;
}

.iconbtn {
  width: 31px;
  height: 31px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  font-size: 0.95rem;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.iconbtn:hover {
  transform: translateY(-1px);
  background: #f0f7ff;
  border-color: #95aed0;
}

.iconbtn.danger:hover {
  background: #fef0ef;
  border-color: #f4b4b0;
}

.form-card {
  border: 1px solid var(--line);
  background: var(--panel-strong);
  border-radius: var(--radius-md);
  padding: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

.auth-actions {
  margin-top: 18px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.92rem;
  font-weight: 800;
  color: #1a3658;
}

input[type='text'],
input[type='number'],
input[type='date'],
input[type='time'],
input[type='datetime-local'],
input[type='password'],
select,
textarea {
  width: 100%;
  height: var(--ctl-h);
  border: 1px solid #b9c7da;
  background: #ffffff;
  border-radius: 11px;
  padding: 0 12px;
  font-family: inherit;
  color: #10243a;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

textarea {
  min-height: 110px;
  padding: 10px 12px;
  height: auto;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #54a9c7;
  box-shadow: 0 0 0 3px rgba(84, 169, 199, 0.2);
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 12px;
}

.checkbox label {
  margin: 0;
}

input[type='checkbox'] {
  transform: scale(1.15);
}

.error-message {
  margin-top: 6px;
  color: var(--danger);
  font-size: 0.88rem;
  font-weight: 700;
}

.btn,
.btn2,
button[type='submit'] {
  height: var(--ctl-h);
  border-radius: 11px;
  padding: 0 16px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.btn,
button[type='submit'] {
  background: linear-gradient(135deg, var(--accent), #1a8fb0);
  border-color: #1f88a5;
  color: #ffffff;
}

.btn:hover,
button[type='submit']:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.btn2 {
  background: #ffffff;
  border-color: #b7c8db;
  color: #203956;
}

.btn2:hover {
  transform: translateY(-1px);
  background: #f4f8fd;
}

.btn-disabled {
  background: #96a9bf;
  border-color: #96a9bf;
  color: #ffffff;
}

.message {
  border-radius: 12px;
  border: 1px solid #b8d4f4;
  background: #eff6ff;
  color: #123a66;
  padding: 11px 12px;
  margin-bottom: 12px;
  font-weight: 700;
}

.message.success {
  border-color: #abd7c2;
  background: #ecfaf3;
  color: #125639;
}

.message.error {
  border-color: #efb8b6;
  background: #fff2f1;
  color: #7f1c1a;
}

.message.warning {
  border-color: #f0d0a8;
  background: #fff7ea;
  color: #8f4f06;
}

.paginator {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
}

.pagination {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.pagination li {
  margin: 0;
}

.pagination a,
.pagination span {
  min-width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid #c6d4e5;
  background: #ffffff;
  color: #1e3757;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 700;
}

.pagination a:hover {
  background: #edf5ff;
}

.pagination .current {
  border-color: #20779e;
  background: linear-gradient(135deg, #0f8d8a, #2278a0);
  color: #ffffff;
}

.filterbar-inline {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin: 10px 0 16px;
}

.filter-item {
  display: flex;
  flex-direction: column;
  min-width: 220px;
}

.filterbar-template-rows .filter-item-wide {
  flex: 1 1 520px;
  min-width: 300px;
}

.filterbar-template-rows .filter-item {
  flex: 0 0 220px;
}

.filter-label-inline {
  font-weight: 800;
  margin-bottom: 6px;
}

.filter-input {
  height: var(--ctl-h);
}

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

#customerSwitch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.customer-input-wrap {
  position: relative;
  display: inline-block;
}

#customerSwitchInput {
  width: 190px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(176, 211, 243, 0.45);
  background: rgba(242, 249, 255, 0.95);
  color: #1b3553;
  font-weight: 700;
}

#customerSwitchInput:focus {
  border-color: #79bdd8;
  box-shadow: 0 0 0 3px rgba(79, 160, 191, 0.28);
}

#customerSwitchDropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: 38px;
  border: 1px solid #bfd0e3;
  border-radius: 10px;
  background: #ffffff;
  max-height: 280px;
  overflow: auto;
  z-index: 100;
  box-shadow: 0 16px 30px rgba(7, 17, 28, 0.24);
}

#customerSwitchDropdown[hidden] {
  display: none !important;
}

#customerSwitchDropdown .admin-customer-switch__item {
  padding: 10px 12px;
  cursor: pointer;
  color: #16365a;
  font-weight: 700;
}

#customerSwitchDropdown .admin-customer-switch__item:hover {
  background: #eef6ff;
}

.t-right {
  text-align: right;
}

.inline-edit {
  cursor: pointer;
}

.inline-edit.is-empty {
  color: #8ea1b7;
}

.inline-placeholder {
  font-style: italic;
}

.icon-ok,
.icon-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #ffffff;
  font-weight: 700;
}

.icon-ok {
  background: var(--success);
  font-size: 1rem;
}

.icon-no {
  background: var(--danger);
  font-size: 0.85rem;
}

.auth-body {
  min-height: 100vh;
  background:
    radial-gradient(860px 520px at 10% 0%, rgba(31, 118, 161, 0.65), transparent 60%),
    radial-gradient(900px 540px at 100% 10%, rgba(15, 141, 138, 0.58), transparent 62%),
    linear-gradient(170deg, #0a1727 0%, #132841 55%, #153556 100%);
  color: #e8f3ff;
}

.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
}

.auth-card {
  width: min(460px, 100%);
  border-radius: 22px;
  border: 1px solid rgba(205, 228, 250, 0.26);
  background: linear-gradient(170deg, rgba(17, 40, 62, 0.88), rgba(13, 31, 48, 0.86));
  backdrop-filter: blur(10px);
  box-shadow: 0 22px 54px rgba(4, 10, 17, 0.42);
  padding: 22px;
  animation: content-enter 0.45s ease;
}

.auth-brand {
  margin-bottom: 16px;
}

.auth-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.01em;
}

.auth-sub {
  margin-top: 4px;
  color: #9fc3e5;
  font-weight: 700;
}

.auth-card label {
  color: #e1efff;
}

.auth-card input[type='text'],
.auth-card input[type='password'] {
  border-color: rgba(182, 211, 239, 0.38);
  background: rgba(247, 252, 255, 0.95);
}

.auth-foot {
  color: rgba(223, 236, 249, 0.7);
  font-size: 0.86rem;
  font-weight: 700;
}

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

@media (max-width: 1080px) {
  .layout {
    gap: 10px;
    margin: 0 12px 12px;
  }

  .header {
    margin: 12px;
    padding-inline: 14px;
  }

  .sidebar {
    width: 220px;
  }

  .sidebar.collapsed {
    width: 72px;
  }

  .card-main {
    min-height: calc(100vh - 170px);
  }
}

@media (max-width: 860px) {
  .layout {
    flex-direction: column;
  }

  .sidebar,
  .sidebar.collapsed {
    width: 100%;
  }

  .side-nav {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
  }

  .sidebar a,
  .sidebar.collapsed a {
    justify-content: flex-start;
    padding: 10px 12px;
  }

  .sidebar.collapsed a .side-label {
    opacity: 1;
    position: static;
    transform: none;
    background: transparent;
    box-shadow: none;
    padding: 0;
  }

  .header {
    flex-wrap: wrap;
    height: auto;
    min-height: var(--header-height);
    padding-block: 10px;
  }

  .header-user {
    white-space: normal;
  }

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .filter-item,
  .filterbar-template-rows .filter-item,
  .filterbar-template-rows .filter-item-wide {
    min-width: 100%;
    flex: 1 1 100%;
  }
}
