:root {
  --ink: #17202a;
  --muted: #667085;
  --line: #d9e1ea;
  --soft: #f4f7fb;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #eef3f7;
  font-family: Arial, Helvetica, sans-serif;
}

aside {
  position: fixed;
  inset: 0 auto 0 0;
  width: 230px;
  background: #102a43;
  color: #fff;
  padding: 24px 18px;
}

.brand {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 28px;
}

nav {
  display: grid;
  gap: 6px;
}

nav a,
.logout {
  color: #dbe7f1;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 6px;
}

nav a.active,
nav a:hover,
.logout:hover {
  background: #1e3a56;
  color: #fff;
}

.logout {
  position: absolute;
  bottom: 20px;
  left: 18px;
  right: 18px;
}

main {
  margin-left: 230px;
  padding: 32px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 18px;
  margin: 22px 0 12px;
}

.panel,
table,
.stat,
.share-card,
.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(16, 42, 67, 0.06);
}

.panel {
  padding: 22px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat {
  padding: 18px;
}

.stat span {
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}

.stat strong {
  font-size: 28px;
}

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

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

th {
  background: #f7fafc;
  color: #344054;
  font-size: 13px;
}

tr:last-child td {
  border-bottom: 0;
}

a {
  color: var(--accent);
  font-weight: 600;
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  padding: 10px 16px;
  text-decoration: none;
}

.button:hover,
button:hover {
  background: var(--accent-dark);
}

.button.secondary,
button.secondary {
  background: #315c77;
}

.button.secondary:hover,
button.secondary:hover {
  background: #254a61;
}

.pay-button {
  background: #00a8a8;
}

.pay-button:hover {
  background: #008f8f;
}

.status {
  color: #9a5b00;
  font-weight: 700;
}

.status.paid {
  color: var(--accent);
}

.header-actions,
.share-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.share-actions {
  justify-content: center;
}

.header-actions form {
  margin: 0;
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 18px;
}

.tabs a {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #315c77;
  padding: 9px 12px;
  text-decoration: none;
}

.tabs a.active,
.tabs a:hover {
  background: #315c77;
  border-color: #315c77;
  color: #fff;
}

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

.actions form {
  margin: 0;
}

.actions button {
  min-height: 0;
  padding: 0;
  color: var(--danger);
  background: transparent;
}

form label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #c6d1de;
  border-radius: 6px;
  color: var(--ink);
  font: inherit;
  padding: 10px 11px;
  background: #fff;
}

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

.grid {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

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

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

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

details {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
  background: #fbfdff;
}

summary {
  cursor: pointer;
  font-weight: 700;
  margin-bottom: 12px;
}

.invoice-lines {
  display: grid;
  gap: 10px;
}

.line-row {
  display: grid;
  grid-template-columns: 1.1fr 1.8fr 0.55fr 0.7fr 0.55fr auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.icon-button {
  min-height: 40px;
  background: #fff;
  border: 1px solid #d0d8e2;
  color: var(--danger);
  padding: 9px 12px;
}

.icon-button:hover {
  background: #fff1f0;
}

.summary-preview {
  width: min(420px, 100%);
  margin: 8px 0 20px auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}

.summary-preview p {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin: 8px 0;
}

.summary-preview .grand {
  border-top: 1px solid var(--line);
  font-size: 18px;
  padding-top: 12px;
}

.totals {
  margin-left: auto;
  max-width: 360px;
}

.totals p {
  display: flex;
  justify-content: space-between;
  margin: 8px 0;
}

.totals .grand {
  border-top: 1px solid var(--line);
  font-size: 18px;
  padding-top: 12px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

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

.notice {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  padding: 14px;
}

.login-page,
.share {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card,
.share-card {
  width: min(430px, 100%);
  padding: 26px;
}

.login-card {
  display: grid;
  gap: 14px;
}

.share-card {
  text-align: center;
}

@media (max-width: 860px) {
  aside {
    position: static;
    width: auto;
  }

  .logout {
    position: static;
    display: block;
    margin-top: 10px;
  }

  main {
    margin-left: 0;
    padding: 20px;
  }

  header,
  .header-actions,
  .actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .share-actions {
    align-items: center;
    flex-direction: row;
    justify-content: center;
  }

  .stats,
  .two,
  .three,
  .four,
  .line-row {
    grid-template-columns: 1fr;
  }

  .tabs {
    flex-direction: column;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}
