:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #17202a;
  --muted: #667085;
  --line: #e4e7ec;
  --primary: #111827;
  --success: #157347;
  --danger: #b42318;
  --info: #175cd3;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

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

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  font-weight: 900;
  letter-spacing: .08em;
  font-size: 20px;
}

.subtitle {
  color: var(--muted);
  margin-top: 3px;
  font-size: 13px;
}

.container {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 60px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 22px;
  box-shadow: 0 8px 30px rgba(16, 24, 40, .04);
}

.section-title {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

h1, h2 {
  margin: 0 0 6px;
}

p {
  margin: 0;
  color: var(--muted);
}

textarea {
  width: 100%;
  min-height: 360px;
  resize: vertical;
  border: 1px solid #cfd4dc;
  border-radius: 12px;
  padding: 16px;
  line-height: 1.55;
  background: #fcfcfd;
  outline: none;
  font-family: ui-monospace, SFMono-Regular,
    Menlo, Monaco, Consolas, monospace;
}

textarea:focus,
select:focus,
input:focus {
  border-color: #667085;
  box-shadow: 0 0 0 3px rgba(102, 112, 133, .12);
}

.actions,
.final-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  cursor: pointer;
  font-weight: 700;
}

button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.primary {
  background: var(--primary);
  color: #fff;
}

.success {
  background: var(--success);
  color: #fff;
}

.ghost {
  background: #eef0f3;
  color: #344054;
}

.alert {
  margin-top: 16px;
  border-radius: 10px;
  padding: 13px 15px;
  line-height: 1.5;
}

.alert.info {
  background: #eff8ff;
  color: var(--info);
}

.alert.success {
  background: #ecfdf3;
  color: #027a48;
}

.alert.error {
  background: #fef3f2;
  color: var(--danger);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.info-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}

.info-box span,
.totals span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 5px;
}

.choice-label {
  display: grid;
  gap: 7px;
  font-weight: 700;
  margin-bottom: 18px;
}

select,
input {
  width: 100%;
  border: 1px solid #cfd4dc;
  border-radius: 9px;
  padding: 10px 11px;
  background: #fff;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

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

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

th {
  background: #f9fafb;
  color: #475467;
  font-size: 13px;
}

td small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.missing {
  color: var(--danger);
  font-weight: 700;
}

.totals {
  margin: 18px 0 0 auto;
  max-width: 340px;
  display: grid;
  gap: 8px;
}

.totals > div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 8px 0;
}

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

.hidden {
  display: none !important;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 16px 50px rgba(16, 24, 40, .08);
}

.login-card h1 {
  margin-top: 24px;
}

.login-form {
  margin-top: 22px;
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 7px;
  font-weight: 700;
}

.full {
  width: 100%;
  margin-top: 6px;
}

@media (max-width: 700px) {
  .topbar {
    padding: 14px 16px;
  }

  .container {
    width: min(100% - 18px, 1180px);
    margin-top: 12px;
  }

  .card {
    padding: 14px;
    border-radius: 12px;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .section-title {
    flex-direction: column;
  }

  textarea {
    min-height: 300px;
  }
}
