:root {
  font-family:
    Inter,
    system-ui,
    -apple-system,
    Segoe UI,
    sans-serif;
  color: #18202f;
  background: #f3f5f9;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
  border: 0;
  border-radius: 9px;
  padding: 10px 15px;
  background: #2447da;
  color: white;
  font-weight: 650;
}
button.secondary {
  background: #e9edf8;
  color: #233454;
}
button.danger {
  background: #fff0f0;
  color: #a22;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
input,
select {
  border: 1px solid #d9deea;
  border-radius: 9px;
  padding: 11px;
  background: white;
  width: 100%;
  min-width: 0;
}
label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 650;
  color: #44506a;
}
header {
  background: #151c30;
  color: white;
  padding: 19px max(22px, calc((100vw - 1200px) / 2));
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: space-between;
}
header h1 {
  font-size: 21px;
  margin: 0;
}
header small {
  color: #b6c2e1;
}
main {
  max-width: 1200px;
  margin: 25px auto;
  padding: 0 18px;
}
nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
nav button {
  background: white;
  color: #4a5671;
  border: 1px solid #e0e5f0;
}
nav button.active {
  background: #2447da;
  color: white;
}
.panel {
  background: white;
  border: 1px solid #e3e8f0;
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: 0 4px 20px #19243b08;
}
.panel h2 {
  margin: 0 0 18px;
  font-size: 19px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 13px;
}
.stat {
  background: #f6f8fd;
  border-radius: 13px;
  padding: 18px;
}
.stat span {
  font-size: 13px;
  color: #66718b;
}
.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}
.row {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}
.row > label {
  flex: 1;
  min-width: 160px;
}
.row > .wide {
  flex: 2;
}
.muted {
  color: #69758e;
  font-size: 13px;
}
.tablewrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th {
  text-align: left;
  background: #f5f7fb;
  color: #56627c;
}
td,
th {
  padding: 12px;
  border-bottom: 1px solid #edf0f6;
  white-space: nowrap;
}
td:last-child {
  text-align: right;
}
.actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.actions button {
  padding: 7px 10px;
  font-size: 12px;
}
.hidden {
  display: none !important;
}
.line {
  display: grid;
  grid-template-columns: 2fr 110px 110px 120px 40px;
  gap: 9px;
  align-items: end;
  margin-bottom: 10px;
}
.total {
  text-align: right;
  font-size: 22px;
  font-weight: 800;
  margin: 14px 0;
}
.tag {
  display: inline-block;
  padding: 5px 9px;
  background: #eaf0ff;
  border-radius: 20px;
  font-size: 12px;
  color: #2447da;
}
.right {
  text-align: right;
}
.spaced {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
#notice {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #18223c;
  color: white;
  padding: 12px 18px;
  border-radius: 10px;
  display: none;
  z-index: 2;
}
footer {
  padding: 15px 0 30px;
  text-align: center;
  color: #69758e;
  font-size: 12px;
}
@media (max-width: 700px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .line {
    grid-template-columns: 1fr 75px 75px;
  }
  .line .line-total {
    display: none;
  }
  .line button {
    grid-column: 3;
  }
  .panel {
    padding: 15px;
  }
  .stat strong {
    font-size: 19px;
  }
}

#authGate {
  position: fixed;
  inset: 0;
  background: #101b33;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
#authGate .panel {
  width: min(440px, 100%);
  padding: 28px;
}
#authGate input {
  width: 100%;
}
#authGate label {
  display: block;
  margin: 12px 0;
}
#authGate button {
  width: 100%;
  margin-top: 12px;
}
#cloudStatus {
  font-size: 12px;
  margin-top: 8px;
  color: #d9e4ff;
}
#adminNotice {
  color: #b42318;
}
#adminUsers td {
  padding: 8px;
}
#authGate.hidden {
  display: none !important;
}

main[inert] {
  opacity: 0.65;
}
#syncActions {
  margin: 12px auto;
  max-width: 1164px;
}
pre {
  white-space: pre-wrap;
}
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #d69000;
  outline-offset: 2px;
}
@media print {
  nav,
  button,
  #authGate,
  #syncActions,
  footer {
    display: none !important;
  }
  .panel {
    box-shadow: none;
  }
}
