:root {
  --navy: #071f45;
  --navy-deep: #031226;
  --green: #12915b;
  --gold: #f4c542;
  --paper: #f4f7f8;
  --white: #ffffff;
  --ink: #101828;
  --muted: #667085;
  --line: rgba(7, 31, 69, 0.13);
  --shadow: 0 28px 90px rgba(4, 17, 39, 0.16);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(7, 31, 69, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(7, 31, 69, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: 54px 54px;
  font-family: "Inter", system-ui, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.admin-shell {
  min-height: 100vh;
}

.login-view {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 520px);
  align-items: center;
  gap: clamp(28px, 6vw, 96px);
  padding: clamp(24px, 6vw, 84px);
  overflow: hidden;
  background: radial-gradient(circle at 18% 22%, rgba(244, 197, 66, 0.2), transparent 34%),
    linear-gradient(130deg, rgba(4, 17, 39, 0.98), rgba(7, 70, 64, 0.94));
}

.login-art {
  position: relative;
  min-height: 520px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.04));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.login-art::before {
  content: "";
  position: absolute;
  inset: 64px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 18px;
}

.field-line,
.field-circle,
.field-ball,
.field-run {
  position: absolute;
  display: block;
}

.field-line {
  inset: 64px auto 64px 50%;
  width: 2px;
  background: rgba(255, 255, 255, 0.35);
}

.field-circle {
  top: 50%;
  left: 50%;
  width: 180px;
  height: 180px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.field-ball {
  left: 26%;
  top: 55%;
  width: 22px;
  height: 22px;
  border: 6px solid var(--white);
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 14px rgba(244, 197, 66, 0.2);
  animation: pulseBall 2.2s infinite;
}

.field-run {
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  transform-origin: left;
  animation: runLine 3.4s infinite var(--ease);
}

.run-one {
  left: 29%;
  top: 57%;
  width: 280px;
  transform: rotate(12deg);
}

.run-two {
  right: 18%;
  top: 37%;
  width: 220px;
  animation-delay: 0.8s;
  transform: rotate(-20deg);
}

@keyframes pulseBall {
  50% { transform: scale(1.16); }
}

@keyframes runLine {
  0%, 100% { opacity: 0.25; clip-path: inset(0 100% 0 0); }
  50% { opacity: 1; clip-path: inset(0 0 0 0); }
}

.login-card,
.panel-card,
.record-dialog form {
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.login-card {
  display: grid;
  gap: 18px;
  padding: clamp(28px, 4vw, 48px);
}

.eyebrow {
  margin: 0;
  color: var(--gold);
  font-family: "Barlow", system-ui, sans-serif;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-card h1,
.panel-topbar h2 {
  margin: 0;
  color: var(--navy);
  font-family: "Barlow", system-ui, sans-serif;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 0.95;
}

.login-copy,
.panel-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

label {
  display: grid;
  gap: 8px;
  color: #24364f;
  font-size: 14px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(7, 31, 69, 0.12);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.94);
  outline: none;
  transition: border 180ms var(--ease), box-shadow 180ms var(--ease);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(19, 147, 92, 0.7);
  box-shadow: 0 0 0 4px rgba(19, 147, 92, 0.12);
}

button,
.sidebar-footer a {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 0 16px;
  color: var(--white);
  background: var(--green);
  font-weight: 900;
  transition: transform 180ms var(--ease), box-shadow 180ms var(--ease), background 180ms var(--ease);
}

button:hover,
.sidebar-footer a:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 36px rgba(19, 147, 92, 0.22);
}

.panel-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  color: var(--white);
  background: linear-gradient(180deg, var(--navy-deep), #073b3a);
}

.panel-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--white);
  text-decoration: none;
}

.panel-brand span {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  color: var(--navy);
  background: var(--gold);
  font-family: "Barlow", system-ui, sans-serif;
  font-weight: 900;
}

.panel-brand strong {
  font-family: "Barlow", system-ui, sans-serif;
  font-size: 18px;
  line-height: 0.95;
  text-transform: uppercase;
}

.panel-nav {
  display: grid;
  gap: 8px;
}

.panel-nav button,
.sidebar-footer button {
  justify-content: flex-start;
  width: 100%;
  color: rgba(255, 255, 255, 0.74);
  background: transparent;
  text-align: left;
}

.panel-nav button:hover,
.panel-nav button.active {
  color: var(--white);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.sidebar-footer {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.sidebar-footer a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--navy);
  background: var(--gold);
  text-decoration: none;
}

.panel-main {
  min-width: 0;
  padding: clamp(20px, 4vw, 44px);
}

.panel-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 30px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-actions span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.topbar-actions button,
.card-head button,
.form-actions button,
.dialog-actions button {
  color: var(--navy);
  background: var(--gold);
}

.panel-page {
  display: none;
  animation: pageIn 380ms var(--ease) both;
}

.panel-page.active {
  display: block;
}

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

.metric-grid,
.dashboard-grid,
.editor-grid {
  display: grid;
  gap: 18px;
}

.metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.metric-grid article {
  position: relative;
  overflow: hidden;
  min-height: 150px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--white);
  box-shadow: 0 18px 48px rgba(4, 17, 39, 0.08);
}

.metric-grid article::after {
  content: "";
  position: absolute;
  right: -44px;
  bottom: -54px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(244, 197, 66, 0.2);
}

.metric-grid span,
.panel-card h3 {
  color: var(--navy);
  font-family: "Barlow", system-ui, sans-serif;
  font-weight: 900;
}

.metric-grid strong {
  display: block;
  margin-top: 14px;
  color: var(--green);
  font-family: "Barlow", system-ui, sans-serif;
  font-size: 42px;
}

.metric-grid p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
}

.panel-card {
  padding: 22px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.card-head h3,
.panel-card h3 {
  margin: 0;
  font-size: 22px;
}

.compact-list,
.setup-list,
.record-list {
  display: grid;
  gap: 12px;
}

.empty-state,
.compact-item,
.setup-item,
.record-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.74);
}

.compact-item strong,
.record-item strong {
  display: block;
  color: var(--navy);
}

.compact-item span,
.setup-item span,
.record-item span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.setup-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.setup-item.ok b {
  color: var(--green);
}

.setup-item.missing b {
  color: #b42318;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 14px 12px;
  text-align: left;
}

th {
  color: var(--navy);
  font-size: 12px;
  text-transform: uppercase;
}

td {
  color: #344054;
  font-size: 14px;
}

.editor-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.editor-grid .panel-card {
  display: grid;
  gap: 16px;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
}

.form-actions p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.record-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
}

.record-item .actions {
  display: flex;
  gap: 8px;
}

.record-item .actions button,
.ghost {
  color: var(--navy);
  background: rgba(7, 31, 69, 0.08);
  box-shadow: none;
}

.record-dialog {
  width: min(680px, calc(100% - 28px));
  border: 0;
  padding: 0;
  border-radius: 22px;
  background: transparent;
}

.record-dialog::backdrop {
  background: rgba(4, 17, 39, 0.58);
  backdrop-filter: blur(8px);
}

.record-dialog form {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-head h3 {
  margin: 0;
  color: var(--navy);
  font-family: "Barlow", system-ui, sans-serif;
  font-size: 24px;
}

.dialog-head button {
  min-height: 40px;
  width: 40px;
  padding: 0;
  color: var(--navy);
  background: rgba(7, 31, 69, 0.08);
}

.dialog-fields {
  display: grid;
  gap: 14px;
}

@media (max-width: 1040px) {
  .panel-view,
  .login-view {
    grid-template-columns: 1fr;
  }

  .login-art {
    min-height: 320px;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .metric-grid,
  .dashboard-grid,
  .editor-grid {
    grid-template-columns: 1fr;
  }

  .form-actions {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .login-view,
  .panel-main,
  .sidebar {
    padding: 18px;
  }

  .panel-topbar,
  .card-head,
  .form-actions,
  .record-item {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .record-item {
    display: grid;
  }
}
