@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@500;600;700;800&family=Space+Grotesk:wght@600;700&display=swap");

:root {
  --bg-dark: #0b141f;
  --bg-mid: #15334a;
  --bg-soft: #f2f8fc;
  --card: #ffffff;
  --text: #11263a;
  --text-muted: #4f667a;
  --line: #d4e1eb;
  --brand: #1e90ff;
  --brand-deep: #0a5da8;
  --ok: #e6f8ef;
  --warn: #fff4dc;
  --err: #ffeaea;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 14px 40px rgba(7, 27, 46, 0.14);
}

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

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  font-family: "Manrope", "Segoe UI", "Tahoma", sans-serif;
  background:
    radial-gradient(circle at 14% 16%, rgba(40, 124, 197, 0.25), transparent 38%),
    radial-gradient(circle at 88% 10%, rgba(15, 173, 160, 0.23), transparent 32%),
    linear-gradient(180deg, #edf5fb 0%, #f7fbfe 48%, #eef6fc 100%);
}

.container {
  width: min(1120px, 92vw);
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(8px);
  background: rgba(10, 30, 48, 0.84);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.topbar-inner {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(140deg, #1e90ff, #00b6ad);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-weight: 700;
}

.brand-text {
  color: #f2fbff;
  letter-spacing: 0.02em;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-weight: 700;
  font-size: 1rem;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.main-nav > * {
  flex: 0 0 auto;
}

.main-nav a {
  text-decoration: none;
  color: #e9f2f9;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.5rem 0.8rem;
}

.main-nav a:hover {
  background: rgba(255, 255, 255, 0.12);
}

.page-main {
  flex: 1;
  padding: 1.05rem 0 2.4rem;
}

.auth-page .page-main {
  display: flex;
  align-items: center;
  justify-content: center;
}

h1 {
  margin: 0 0 0.95rem 0;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: clamp(1.35rem, 4.7vw, 2rem);
  line-height: 1.08;
}

h2 {
  margin: 0 0 0.8rem 0;
  font-size: clamp(1.02rem, 3.8vw, 1.22rem);
}

p {
  margin-top: 0;
  color: var(--text-muted);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(0.95rem, 2.7vw, 1.3rem);
  margin-bottom: 0.95rem;
  animation: rise 360ms ease both;
}

.narrow {
  max-width: 620px;
}

.card a {
  color: var(--brand-deep);
  font-weight: 700;
}

.card > a {
  display: inline-flex;
  margin-top: 0.3rem;
  border-radius: 999px;
  background: #eaf4ff;
  border: 1px solid #b9d9f5;
  padding: 0.5rem 0.85rem;
  text-decoration: none;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.stat {
  padding: 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #f8fcff;
}

.stat .label {
  margin: 0 0 0.2rem;
  color: #60778b;
  font-size: 0.82rem;
  font-weight: 700;
}

.stat .value {
  margin: 0;
  color: #12314d;
  font-weight: 800;
}

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

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

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.68rem 0.52rem;
  border-bottom: 1px solid var(--line);
}

th {
  color: #486179;
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td {
  color: #19334c;
  font-size: 0.95rem;
}

form p {
  margin: 0 0 0.7rem 0;
}

form ul.errorlist {
  margin: 0 0 0.55rem;
  padding: 0.6rem 0.8rem 0.6rem 1.4rem;
  border-radius: 10px;
  border: 1px solid #f2b8b8;
  background: #fff2f2;
  color: #8b2020;
  font-size: 0.92rem;
}

form .helptext {
  display: block;
  margin-top: 0.24rem;
  color: #668197;
  font-size: 0.8rem;
}

label {
  display: block;
  margin: 0 0 0.3rem;
  color: #355267;
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select,
textarea,
button {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #c6d6e5;
  font-size: 1rem;
  font-family: "Manrope", "Segoe UI", "Tahoma", sans-serif;
}

input,
select,
textarea {
  min-height: 50px;
  padding: 0.72rem 0.82rem;
  background: #fff;
}

textarea {
  min-height: 116px;
  resize: vertical;
}

button {
  min-height: 52px;
  border: 0;
  cursor: pointer;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(130deg, #0a72cf, #14a796);
  box-shadow: 0 12px 24px rgba(10, 114, 207, 0.28);
  transition: transform 0.15s ease, filter 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.02);
}

button:active {
  transform: translateY(0);
}

.inline-form {
  margin: 0;
}

.inline-form button {
  width: auto;
  min-height: 38px;
  padding: 0.5rem 0.85rem;
  margin: 0;
  box-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: transparent;
}

.inline-form-danger {
  display: grid;
  gap: 0.42rem;
  min-width: 240px;
}

.inline-form-danger label {
  margin: 0;
  font-size: 0.78rem;
}

.inline-form-danger input {
  min-height: 38px;
  padding: 0.45rem 0.62rem;
  font-size: 0.88rem;
}

.inline-form-danger .danger-button {
  width: 100%;
  min-height: 38px;
  border: 1px solid #f3b5b5;
  color: #8d1f1f;
  background: #fff1f1;
  box-shadow: none;
}

.inline-form-danger .danger-button:hover {
  background: #ffe7e7;
  filter: none;
}

.messages {
  margin-bottom: 0.9rem;
}

.message {
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 0.7rem 0.8rem;
  margin-bottom: 0.55rem;
  font-weight: 600;
}

.message.success {
  background: var(--ok);
}

.message.warning {
  background: var(--warn);
}

.message.error {
  background: var(--err);
}

@media (max-width: 860px) {
  .topbar-inner {
    padding: 0.7rem 0;
    min-height: 70px;
    align-items: flex-start;
    flex-direction: column;
  }

  .main-nav {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    white-space: nowrap;
    flex-wrap: nowrap;
    padding-bottom: 0.1rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
}

@media (max-width: 760px) {
  .container {
    width: min(900px, 94vw);
  }

  .card {
    border-radius: 16px;
  }

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

  .responsive-table thead {
    display: none;
  }

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

  .responsive-table tr {
    margin-bottom: 0.65rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.3rem 0.45rem;
    background: #fbfdff;
  }

  .responsive-table td {
    border-bottom: 0;
    padding: 0.36rem 0.2rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.8rem;
  }

  .responsive-table td::before {
    content: attr(data-label);
    color: #567087;
    font-weight: 800;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex: 0 0 42%;
  }
}

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