:root {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --panel-soft: #f8fbff;
  --blue: #0057d9;
  --blue-dark: #071b44;
  --soft: #eef5ff;
  --soft-green: #edf8f1;
  --text: #1f2937;
  --muted: #5d6675;
  --line: rgba(31, 41, 55, 0.12);
  --green: #0b6b3a;
  --green-dark: #084f2c;
  --gold: #d4af37;
  --gold-soft: #fff7df;
  --red: #b42318;
  --shadow: 0 18px 48px rgba(31, 41, 55, 0.11);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(0, 87, 217, 0.08), rgba(11, 107, 58, 0.06) 36%, rgba(255, 255, 255, 0) 62%),
    linear-gradient(180deg, #ffffff 0%, #f8fafc 48%, var(--bg) 100%);
  color: var(--text);
  font-family: Inter, "Open Sans", Arial, sans-serif;
}

img {
  height: auto;
  max-width: 100%;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

button,
input,
select,
textarea,
.button,
.panel,
nav a {
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease, color 0.15s ease;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
}

input:hover,
select:hover,
textarea:hover {
  border-color: rgba(0, 87, 217, 0.35);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--green);
}

.password-field {
  display: grid;
  position: relative;
}

.password-field input {
  padding-right: 48px;
}

.password-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  height: 36px;
  justify-content: center;
  padding: 0;
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
}

.password-toggle::before {
  border: 2px solid var(--blue-dark);
  border-radius: 50% 50% 45% 45%;
  content: "";
  height: 14px;
  opacity: 0.75;
  transform: rotate(-12deg);
  width: 22px;
}

.password-toggle::after {
  background: var(--blue-dark);
  border-radius: 50%;
  content: "";
  height: 6px;
  left: 15px;
  opacity: 0.75;
  position: absolute;
  top: 15px;
  width: 6px;
}

.password-toggle.is-visible::before,
.password-toggle.is-visible::after {
  opacity: 1;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.topbar {
  align-items: center;
  background:
    linear-gradient(135deg, rgba(7, 27, 68, 0.96), rgba(20, 89, 200, 0.88)),
    var(--blue-dark);
  border-bottom: 1px solid rgba(212, 175, 55, 0.26);
  box-shadow: 0 18px 46px rgba(7, 27, 68, 0.18);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  min-height: 84px;
  padding: 0 clamp(18px, 4vw, 56px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  align-items: center;
  color: white;
  display: flex;
  font-weight: 900;
  gap: 12px;
  letter-spacing: -0.01em;
}

.brand span {
  background: white;
  border: 1px solid rgba(212, 175, 55, 0.52);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
  display: grid;
  height: 52px;
  place-items: center;
  padding: 5px;
  width: 82px;
}

.brand img {
  display: block;
  max-height: 54px;
  width: 92px;
}

nav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

nav a {
  border: 1px solid transparent;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 15px;
  font-weight: 800;
  padding: 11px 10px;
  text-align: center;
}

nav a:hover {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.page {
  margin: 0 auto;
  max-width: 1200px;
  padding: 42px clamp(16px, 4vw, 54px) 72px;
}

.page-title {
  margin-bottom: 22px;
  max-width: 760px;
}

.page-title h1,
.section h2 {
  letter-spacing: -0.03em;
  margin: 0 0 8px;
}

.page-title h1 {
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1;
}

.section h2 {
  font-size: clamp(24px, 3vw, 34px);
}

.page-title p,
.section p {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
  margin: 0;
}

.section { margin-top: 32px; }

.actions,
.row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
}

.actions {
  justify-content: flex-start;
  margin-top: 24px;
}

.button {
  align-items: center;
  background: linear-gradient(135deg, var(--blue), var(--green));
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  box-shadow: 0 16px 34px rgba(11, 107, 58, 0.18);
  color: white;
  display: inline-flex;
  font-weight: 900;
  justify-content: center;
  min-height: 44px;
  padding: 11px 16px;
  text-align: center;
}

.button:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, var(--blue-dark), var(--green-dark));
}

.button.light {
  background: white;
  border-color: var(--line);
  box-shadow: none;
  color: var(--blue-dark);
}

.button.gold {
  background: var(--gold);
  border-color: var(--gold);
  color: #1f2937;
}

.logout-button {
  background: #ffe4e0;
  border: 0;
  border-radius: 999px;
  color: var(--red);
  font-size: 14px;
  font-weight: 900;
  padding: 10px 13px;
}

.panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    min-height: auto;
    padding: 14px 16px;
  }

  nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  nav a,
  nav button {
    width: 100%;
  }
}

.table-wrap {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 38px rgba(20, 89, 200, 0.06);
  overflow-x: auto;
}

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

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

th {
  background: #f3f7ff;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdff; }

.badge {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  padding: 6px 10px;
  text-transform: capitalize;
}

.active, .open, .paid, .success { background: #dbeafe; color: #1d4ed8; }
.pending { background: var(--gold-soft); color: #075985; }
.inactive, .closed, .overdue, .error { background: #ffe4e0; color: var(--red); }
.rejected { background: #fee2e2; color: #991b1b; }
.hidden { display: none; }

@media (max-width: 860px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    padding: 12px 14px;
  }

  .brand {
    font-size: 15px;
    gap: 10px;
    line-height: 1.1;
  }

  .brand span {
    flex: 0 0 auto;
    height: 44px;
    width: 70px;
  }

  .brand img {
    max-height: 38px;
    width: 62px;
  }

  nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  nav a {
    background: rgba(234, 242, 255, 0.72);
    min-height: 42px;
    padding: 11px 10px;
  }

  .logout-button {
    min-height: 42px;
    width: 100%;
  }

  .page {
    padding: 24px 14px 44px;
  }

  .page-title h1 {
    font-size: clamp(32px, 10vw, 44px);
  }

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

  .actions .button,
  .row .button {
    width: 100%;
  }

  .panel {
    padding: 16px;
  }

  .table-wrap {
    border-radius: 8px;
    margin-left: -2px;
    margin-right: -2px;
  }
}

@media (max-width: 420px) {
  nav {
    grid-template-columns: 1fr;
  }

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

  .button {
    width: 100%;
  }
}

@media (max-width: 760px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 38%, #f3f4f6 100%);
  }

  .topbar {
    position: sticky;
    top: 8px;
    width: calc(100% - 18px);
    margin: 8px auto 0;
    border: 1px solid rgba(0, 87, 217, 0.12);
    border-radius: 18px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 14px 34px rgba(7, 27, 68, 0.1);
  }

  .brand {
    width: 100%;
    min-width: 0;
    align-items: center;
  }

  .brand span {
    height: 46px;
    width: 72px;
  }

  .brand img {
    max-height: 38px;
    width: 64px;
  }

  nav {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  nav a,
  .logout-button {
    min-height: 42px;
    border: 1px solid rgba(0, 87, 217, 0.1);
    border-radius: 999px;
    background: #ffffff;
    color: #071b44;
    font-size: 13px;
  }

  .page {
    padding: 30px 16px 54px;
  }

  .page-title h1 {
    font-size: clamp(32px, 10vw, 44px);
    line-height: 1.04;
  }

  .panel {
    padding: 18px;
  }

  .table-wrap {
    margin-inline: -4px;
  }

  table {
    min-width: 640px;
  }
}

@media (max-width: 420px) {
  nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
