:root {
  --pink: #e6b0ce;
  --pink-deep: #9d3f68;
  --blush: #fff7fb;
  --ink: #1c191a;
  --muted: #5c5358;
  --line: #f0d0e0;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(ellipse 70% 40% at 0% 0%, #f8d7e8 0%, transparent 60%),
    var(--blush);
  font-family: "Nunito", "Segoe UI", sans-serif;
}

.login-page:not([hidden]) {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.15rem;
  width: min(300px, 100%);
  margin: 0;
  padding: 1.6rem 1.35rem 1.35rem;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 18px 46px rgba(157, 63, 104, 0.16);
}

.login-card img {
  display: block;
  width: 168px;
  height: auto;
  margin: 0;
}

.login-page form {
  width: 100%;
  margin: 0;
  padding: 0;
  gap: 0.7rem;
  background: transparent;
  box-shadow: none;
}

.login-page button {
  width: 100%;
}

.login-page input {
  width: 100%;
  background: var(--blush);
  text-align: center;
}

a.back-site {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  padding: 0.55rem 1rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

a.back-site:hover {
  background: var(--white);
  color: var(--ink);
}

.panel {
  width: min(460px, calc(100% - 2rem));
  margin: 8vh auto;
}

.panel.wide {
  width: min(980px, calc(100% - 2rem));
  margin: 2rem auto 3rem;
}

.brand {
  margin: 0;
  font-family: "Caveat", cursive;
  font-size: 2rem;
  color: var(--pink-deep);
}

h1,
h2 {
  margin: 0.2rem 0 0.6rem;
  letter-spacing: -0.03em;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.15rem;
}

.hint,
label {
  color: var(--muted);
}

form {
  display: grid;
  gap: 0.45rem;
  margin-top: 1.2rem;
  padding: 1.2rem;
  background: var(--white);
  border-radius: 22px;
  box-shadow: 0 16px 40px rgba(157, 63, 104, 0.12);
}

input,
button,
.top-actions a {
  font: inherit;
}

input {
  min-height: 48px;
  padding: 0.6rem 0.8rem;
  border: 2px solid var(--line);
  border-radius: 12px;
}

button,
.top-actions a {
  min-height: 44px;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--ink);
  color: white;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.top-actions a,
#refresh,
#logout,
.periods button {
  background: var(--white);
  color: var(--ink);
}

.period-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.periods {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.periods button.on {
  background: var(--ink);
  color: white;
}

.average {
  margin: 0.4rem 0 0;
  font-weight: 800;
  color: var(--pink-deep);
}

.error {
  margin: 0;
  color: #9d2040;
  font-weight: 700;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1rem;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cards,
.split {
  display: grid;
  gap: 0.8rem;
}

.cards {
  grid-template-columns: repeat(3, 1fr);
}

.split {
  grid-template-columns: 1fr 1fr;
  margin-top: 0.8rem;
}

.cards article,
.box {
  background: var(--white);
  border-radius: 22px;
  padding: 1rem 1.1rem;
  box-shadow: 0 16px 40px rgba(157, 63, 104, 0.1);
}

.cards p,
.cards span {
  margin: 0;
  color: var(--muted);
}

.cards strong {
  display: block;
  margin: 0.2rem 0;
  font-size: 2.4rem;
  letter-spacing: -0.04em;
}

.box {
  margin-top: 0.8rem;
}

.split .box {
  margin-top: 0;
}

.bars {
  display: flex;
  align-items: end;
  gap: 0.35rem;
  min-height: 160px;
  margin-top: 1rem;
}

.bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: end;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
}

.bar i {
  display: block;
  width: 100%;
  max-width: 28px;
  border-radius: 8px 8px 3px 3px;
  background: var(--pink);
  min-height: 4px;
}

.bar b,
.bar small {
  font-weight: 700;
  font-size: 0.72rem;
}

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

.table-scroll {
  max-height: 240px;
  margin-top: 0.7rem;
  overflow: auto;
}

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

.table-scroll th,
.table-scroll td {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  text-align: left;
}

.table-scroll th:last-child,
.table-scroll td:last-child {
  text-align: right;
}

.table-scroll th {
  position: sticky;
  top: 0;
  background: var(--white);
  color: var(--muted);
  font-size: 0.85rem;
}

.action-list,
.recent {
  list-style: none;
  padding: 0;
  margin: 0.6rem 0 0;
}

.action-list li,
.recent li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--line);
  font-weight: 700;
}

.action-list span,
.recent time {
  color: var(--muted);
  font-weight: 700;
}

.empty {
  color: var(--muted);
  font-weight: 600;
}

:focus-visible {
  outline: 3px solid var(--pink-deep);
  outline-offset: 3px;
}

@media (max-width: 760px) {
  .cards,
  .split,
  .top {
    grid-template-columns: 1fr;
    display: grid;
  }
}
