:root {
  --navy: #272379;
  --navy-deep: #1a1758;
  --sand: #ffdf99;
  --sand-soft: #ffe9b8;
  --yellow: #fdc900;
  --light-blue: #a0ccea;
  --lime: #46d59b;
  --peach: #ff959b;
  --raspberry: #f7b5d5;
  --ink: #f7f3ea;
  --muted: #c9d7ef;
  --line: rgba(160, 204, 234, 0.28);
  --surface: rgba(26, 23, 88, 0.55);
  --danger: #ff959b;
  --font-display: "Totally Oilsome", "Georgia", "Times New Roman", serif;
  --font-body: "Sofia Pro", "Avenir Next", "Segoe UI", sans-serif;
  color-scheme: dark;
}

@font-face {
  font-family: "Totally Oilsome";
  src:
    url("/fonts/TotallyOilsome.otf") format("opentype"),
    url("/fonts/Totally%20Oilsome.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Sofia Pro";
  src: url("/fonts/Sofia%20Pro%20Regular%20Az.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Sofia Pro";
  src: url("/fonts/Sofia%20Pro%20Regular%20Italic%20Az.otf") format("opentype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Sofia Pro";
  src: url("/fonts/Sofia%20Pro%20Medium%20Az.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Sofia Pro";
  src: url("/fonts/Sofia%20Pro%20Semi%20Bold%20Az.otf") format("opentype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Sofia Pro";
  src: url("/fonts/Sofia%20Pro%20Bold%20Az.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(253, 201, 0, 0.18), transparent 55%),
    radial-gradient(ellipse 70% 45% at 100% 0%, rgba(160, 204, 234, 0.22), transparent 50%),
    linear-gradient(-45deg, #3a3590 0%, var(--navy) 42%, var(--navy-deep) 100%);
  background-attachment: fixed;
}

a { color: inherit; }

.bar,
main {
  width: min(1080px, calc(100% - 2rem));
  margin: 0 auto;
  max-width: 100%;
  min-width: 0;
}

.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 0;
}

.brand {
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  background: linear-gradient(-45deg, var(--sand), var(--yellow));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.who {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.75rem;
  color: var(--muted);
}

button,
.button {
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button:hover {
  border-color: var(--light-blue);
  background: rgba(160, 204, 234, 0.08);
}

main { padding-bottom: 3rem; }

h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 2.15rem;
  margin: 0.25rem 0;
  letter-spacing: 0.01em;
}

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

.parks {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.park {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  text-decoration: none;
  background: var(--surface);
  backdrop-filter: blur(8px);
}

.park:hover {
  border-color: var(--sand);
  box-shadow: 0 0 0 1px rgba(255, 223, 153, 0.25);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.25rem;
}

th,
td {
  text-align: left;
  vertical-align: middle;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.85rem;
}

td.qty,
td.power,
th.qty,
th.power,
td.zone-no,
th.zone-no {
  text-align: right;
  white-space: nowrap;
}

td.notes {
  width: 12rem;
  max-width: 12rem;
  vertical-align: top;
  font-size: 0.92rem;
  line-height: 1.35;
}

td.notes span {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  overflow-wrap: anywhere;
  white-space: normal;
}

td.code {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--sand-soft);
  font-size: 0.92rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.35rem 0 0.5rem;
}

.toolbar .muted { margin: 0; }

.button-active {
  border-color: var(--sand);
  background: rgba(255, 223, 153, 0.12);
}

.tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(253, 201, 0, 0.45);
  color: var(--sand);
  font-size: 0.7rem;
  font-weight: 500;
  vertical-align: middle;
}

.photo {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 10px;
  background: var(--surface);
  display: block;
  border: 1px solid var(--line);
}

button.photo-zoom {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 10px;
  cursor: zoom-in;
  min-height: 0;
}

button.photo-zoom:hover .photo,
button.photo-zoom:focus-visible .photo {
  border-color: var(--sand);
}

.lightbox {
  border: 0;
  padding: 0;
  max-width: min(92vw, 1100px);
  max-height: 92vh;
  background: transparent;
  overflow: visible;
}

.lightbox::backdrop {
  background: rgba(10, 8, 40, 0.82);
}

.lightbox img {
  display: block;
  max-width: min(92vw, 1100px);
  max-height: 92vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--navy-deep);
  cursor: zoom-out;
}

.empty-photo {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

form.card,
.card {
  width: min(24rem, 100%);
  max-width: 100%;
  min-width: 0;
  display: grid;
  gap: 0.85rem;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.login h1 {
  font-size: 2.4rem;
  background: linear-gradient(-45deg, var(--sand), var(--yellow));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  min-width: 0;
}

input,
select {
  font: inherit;
  color: var(--ink);
  background: rgba(15, 12, 48, 0.55);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

select {
  text-overflow: ellipsis;
}

input:focus,
select:focus {
  outline: 2px solid rgba(253, 201, 0, 0.45);
  outline-offset: 1px;
}

button.primary {
  background: linear-gradient(-45deg, var(--sand), var(--yellow));
  color: var(--navy-deep);
  border: 0;
  justify-self: start;
  font-weight: 500;
}

button.primary:hover {
  background: linear-gradient(-45deg, var(--sand-soft), var(--yellow));
}

.accounts {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  display: grid;
  gap: 0.75rem;
  min-width: 0;
}

.accounts li {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

main > .muted,
main > p {
  overflow-wrap: anywhere;
  max-width: 100%;
}

@media (max-width: 720px) {
  .bar,
  main {
    width: min(1080px, calc(100% - 1.25rem));
  }

  .bar { align-items: flex-start; }

  .who span {
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  h1 { font-size: 1.65rem; }

  .park,
  button,
  .button {
    min-height: 44px;
  }

  thead { display: none; }
  table,
  tbody { display: block; }

  tr {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    column-gap: 0.75rem;
    row-gap: 0.2rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--line);
  }

  td {
    display: block;
    border: 0;
    padding: 0;
    text-align: left;
  }

  td.photo-cell { grid-row: 1 / span 8; }
  td.photo-cell::before { display: none; }

  td:not(.photo-cell)::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.72rem;
    margin-right: 0.35rem;
  }

  td.name {
    font-weight: 600;
    line-height: 1.3;
  }

  td.name::before { display: none; }

  td.qty,
  td.power,
  td.zone-no {
    text-align: left;
  }

  td.notes {
    max-width: none;
    width: auto;
  }

  td.notes span {
    -webkit-line-clamp: 4;
    line-clamp: 4;
  }

  .photo,
  .empty-photo {
    width: 76px;
    height: 76px;
  }
}
