:root {
  --bg: #f7f4ee;
  --surface: #fffdf8;
  --ink: #241f1b;
  --muted: #71665e;
  --line: #ded5c9;
  --brick: #9f3f28;
  --brick-dark: #642817;
  --green: #237b50;
  --blue: #2f5f9f;
  --gold: #b27a1d;
  --danger: #b53737;
  --shadow: 0 14px 32px rgba(63, 43, 29, 0.12);
}

* {
  box-sizing: border-box;
}

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

.hindi-font {
  font-family: "Nirmala UI", "Mangal", Arial, Helvetica, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #fffaf2;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.brand-row,
.toolbar,
.entry-head,
.user-row,
.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  min-width: 0;
}

.brand h1,
.login-title h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
}

.brand p,
.login-title p,
.muted {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.page {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  align-items: center;
  padding: 20px;
}

.login-panel {
  width: min(460px, 100%);
  margin: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.login-hero {
  min-height: 150px;
  background:
    linear-gradient(rgba(75, 31, 18, 0.62), rgba(75, 31, 18, 0.42)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 900 360'%3E%3Crect width='900' height='360' fill='%23c7663f'/%3E%3Cg fill='%23843b28'%3E%3Crect x='0' y='0' width='150' height='54'/%3E%3Crect x='180' y='0' width='150' height='54'/%3E%3Crect x='360' y='0' width='150' height='54'/%3E%3Crect x='540' y='0' width='150' height='54'/%3E%3Crect x='720' y='0' width='150' height='54'/%3E%3Crect x='90' y='72' width='150' height='54'/%3E%3Crect x='270' y='72' width='150' height='54'/%3E%3Crect x='450' y='72' width='150' height='54'/%3E%3Crect x='630' y='72' width='150' height='54'/%3E%3Crect x='810' y='72' width='150' height='54'/%3E%3Crect x='0' y='144' width='150' height='54'/%3E%3Crect x='180' y='144' width='150' height='54'/%3E%3Crect x='360' y='144' width='150' height='54'/%3E%3Crect x='540' y='144' width='150' height='54'/%3E%3Crect x='720' y='144' width='150' height='54'/%3E%3Crect x='90' y='216' width='150' height='54'/%3E%3Crect x='270' y='216' width='150' height='54'/%3E%3Crect x='450' y='216' width='150' height='54'/%3E%3Crect x='630' y='216' width='150' height='54'/%3E%3Crect x='810' y='216' width='150' height='54'/%3E%3C/g%3E%3Cg fill='%23f0a162' opacity='.45'%3E%3Ccircle cx='720' cy='78' r='60'/%3E%3Cpath d='M70 318h760v42H70z'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: end;
  padding: 18px;
  color: #fff;
}

.login-title h1 {
  font-size: 28px;
}

.login-title p {
  color: #ffead7;
}

.form {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
}

input:focus,
select:focus {
  outline: 2px solid rgba(159, 63, 40, 0.22);
  border-color: var(--brick);
}

.btn {
  min-height: 42px;
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--brick);
  color: white;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn.secondary {
  background: #efe5d8;
  color: var(--brick-dark);
}

.btn.ghost {
  background: transparent;
  color: var(--brick-dark);
  border: 1px solid var(--line);
}

.btn.danger {
  background: var(--danger);
}

.btn.icon {
  width: 42px;
  padding: 0;
  font-size: 18px;
}

.tabs {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: #fffaf2;
  border-top: 1px solid var(--line);
}

.tab {
  min-height: 60px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  gap: 3px;
  padding: 7px 4px;
  font-size: 11px;
  font-weight: 700;
}

.tab span:first-child {
  font-size: 20px;
  line-height: 1;
}

.tab.active {
  color: var(--brick);
  background: #fff1e7;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric,
.panel,
.list-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric {
  padding: 14px;
}

.metric strong {
  display: block;
  margin-top: 7px;
  font-size: 24px;
}

.metric small {
  color: var(--muted);
  font-weight: 700;
}

.panel {
  margin-top: 14px;
  overflow: hidden;
}

.panel-head {
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0;
  font-size: 18px;
}

.panel-body {
  padding: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.full {
  grid-column: 1 / -1;
}

.list {
  display: grid;
  gap: 10px;
}

.list-item {
  padding: 12px;
}

.entry-title {
  font-weight: 800;
}

.entry-meta {
  color: var(--muted);
  margin-top: 5px;
  font-size: 13px;
  line-height: 1.4;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.chip {
  border-radius: 999px;
  padding: 5px 8px;
  background: #efe5d8;
  color: var(--brick-dark);
  font-size: 12px;
  font-weight: 800;
}

.chip.green {
  background: #dff1e7;
  color: var(--green);
}

.chip.blue {
  background: #e2ebf8;
  color: var(--blue);
}

.chip.gold {
  background: #f7ecd0;
  color: var(--gold);
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 24px 12px;
  text-align: center;
  color: var(--muted);
}

.notice {
  border-radius: 6px;
  padding: 10px;
  color: #7c2f1d;
  background: #fff1e7;
  font-size: 13px;
}

.role-badge {
  white-space: nowrap;
  border-radius: 999px;
  padding: 7px 10px;
  color: #fff;
  background: var(--brick-dark);
  font-size: 12px;
  font-weight: 800;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr 170px;
  gap: 10px;
  margin-bottom: 12px;
}

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

.user-table th,
.user-table td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  font-size: 13px;
}

.user-table th {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 11px;
}

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

@media (max-width: 620px) {
  .page {
    padding: 12px;
  }

  .brand h1 {
    font-size: 19px;
  }

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

  .toolbar {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .toolbar .btn {
    min-height: 36px;
    padding: 8px 10px;
  }

  .grid,
  .form-grid,
  .search-row {
    grid-template-columns: 1fr;
  }

  .metric strong {
    font-size: 22px;
  }

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

  .tab.admin-only {
    display: none;
  }

  .user-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}
