/* ==========================================================================
   Manoj Digital Seva — agent dashboard + admin panel
   Layered on top of css/styles.css; reuses the same brand tokens.
   ========================================================================== */

:root {
  --side-w: 252px;
  --bg-app: #f5f7fb;
  --card-radius: 12px;

  --tone-green: #0f9d58;
  --tone-green-bg: #e7f6ee;
  --tone-teal: #0d8a8a;
  --tone-teal-bg: #e2f4f4;
  --tone-amber: #b06a00;
  --tone-amber-bg: #fdf0da;
  --tone-orange: #c2410c;
  --tone-orange-bg: #ffeee4;
  --tone-red: #c0392b;
  --tone-red-bg: #fdecea;
  --tone-blue: #1553c9;
  --tone-blue-bg: #e7eefc;
  --tone-grey: #5c6b85;
  --tone-grey-bg: #eef1f6;
}

/* ==========================================================================
   Shared form + button additions (also used on the public login page)
   ========================================================================== */

.field-help {
  margin-top: 6px;
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.5;
}

.field textarea,
.field select {
  width: 100%;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23475467'%3E%3Cpath d='M8 11.5 2.5 6h11z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px;
  padding-right: 36px;
  cursor: pointer;
}

.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--blue-bright);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

.field-required {
  color: var(--red);
  margin-left: 2px;
}

.form-status-error { color: var(--red); }
.form-status-ok    { color: var(--tone-green); }
.form-status-info  { color: var(--muted); }

.login-note {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  background: var(--tone-blue-bg);
  border: 1px solid rgba(21, 83, 201, 0.18);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--navy);
}

.login-note i {
  color: var(--blue);
  margin-top: 3px;
}

.login-note a {
  color: var(--blue);
  font-weight: 600;
  text-decoration: underline;
}

/* Buttons -------------------------------------------------------------- */

.btn-solid,
.btn-ghost,
.btn-danger,
.btn-soft {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1;
  padding: 11px 18px;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s, transform 0.12s, box-shadow 0.18s;
  white-space: nowrap;
}

.btn-solid {
  background: var(--blue);
  color: var(--white);
}

.btn-solid:hover:not(:disabled) {
  background: var(--navy);
  box-shadow: var(--shadow-md);
}

.btn-ghost {
  background: var(--white);
  color: var(--muted);
  border-color: var(--line);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--navy);
  border-color: var(--blue);
  background: var(--tone-blue-bg);
}

.btn-soft {
  background: var(--tone-blue-bg);
  color: var(--navy);
}

.btn-soft:hover:not(:disabled) {
  background: #d8e4fb;
}

.btn-danger {
  background: var(--tone-red-bg);
  color: var(--tone-red);
  border-color: rgba(192, 57, 43, 0.25);
}

.btn-danger:hover:not(:disabled) {
  background: var(--tone-red);
  color: var(--white);
}

.btn-solid:active:not(:disabled),
.btn-ghost:active:not(:disabled),
.btn-danger:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-solid:disabled,
.btn-ghost:disabled,
.btn-danger:disabled,
.btn-soft:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 0.78rem;
}

.btn-block {
  width: 100%;
}

/* ==========================================================================
   App shell
   ========================================================================== */

body.app-body {
  background: var(--bg-app);
}

.app {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  min-height: 100vh;
}

/* Sidebar --------------------------------------------------------------- */

.app-sidebar {
  background: var(--navy);
  color: rgba(255, 255, 255, 0.82);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1.1rem 1.15rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.side-brand img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  background: var(--white);
  border-radius: 8px;
  padding: 3px;
  flex-shrink: 0;
}

.side-brand span {
  display: block;
  color: var(--white);
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  line-height: 1.25;
}

.side-brand small {
  display: block;
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

.side-nav {
  padding: 0.9rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.side-label {
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
  padding: 1rem 0.6rem 0.4rem;
  font-weight: 700;
}

/* Used on both <a> and <button>, so the browser's default button chrome
   (grey background, border, centred text) has to be reset explicitly. */
.side-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  text-align: left;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background 0.18s, color 0.18s;
}

.side-link i {
  width: 18px;
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.9;
}

.side-link:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--white);
}

.side-link.active {
  background: var(--blue);
  color: var(--white);
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.side-count {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-pill);
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 700;
}

.side-link.active .side-count {
  background: rgba(0, 0, 0, 0.22);
}

.side-foot {
  padding: 0.9rem 1.15rem 1.2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.6;
}

.side-foot a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: underline;
}

/* Topbar ---------------------------------------------------------------- */

.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  padding: 0.85rem 1.6rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.15rem;
  color: var(--navy);
  cursor: pointer;
  padding: 4px 8px;
}

.topbar-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--navy);
  margin-right: auto;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 5px 6px 5px 12px;
  border-radius: var(--radius-pill);
  background: var(--bg-app);
  border: 1px solid var(--line);
}

.user-chip-text {
  text-align: right;
  line-height: 1.25;
  min-width: 0;
}

.user-chip-text strong {
  display: block;
  font-size: 0.82rem;
  color: var(--navy);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.user-chip-text span {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--blue);
  color: var(--white);
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.icon-btn:hover {
  background: var(--tone-red-bg);
  color: var(--tone-red);
  border-color: rgba(192, 57, 43, 0.25);
}

/* Content --------------------------------------------------------------- */

.app-content {
  padding: 1.5rem 1.6rem 3rem;
  flex: 1;
  max-width: 1400px;
  width: 100%;
}

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

.page-head h1 {
  font-size: 1.35rem;
  color: var(--navy);
  font-weight: 800;
  line-height: 1.3;
}

.page-head p {
  color: var(--muted);
  font-size: 0.86rem;
  margin-top: 2px;
}

.page-head-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   Cards + stats
   ========================================================================== */

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
}

.card + .card {
  margin-top: 1.15rem;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--line);
}

.card-head h2 {
  font-size: 0.98rem;
  color: var(--navy);
  font-weight: 700;
}

.card-head p {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

.card-body {
  padding: 1.2rem;
}

.card-body-flush {
  padding: 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1.4rem;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  padding: 1.05rem 1.15rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 0.9rem;
  transition: transform 0.18s, box-shadow 0.18s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  flex-shrink: 0;
  background: var(--tone-blue-bg);
  color: var(--tone-blue);
}

.stat-icon.green  { background: var(--tone-green-bg);  color: var(--tone-green); }
.stat-icon.amber  { background: var(--tone-amber-bg);  color: var(--tone-amber); }
.stat-icon.red    { background: var(--tone-red-bg);    color: var(--tone-red); }
.stat-icon.teal   { background: var(--tone-teal-bg);   color: var(--tone-teal); }
.stat-icon.grey   { background: var(--tone-grey-bg);   color: var(--tone-grey); }
.stat-icon.orange { background: var(--tone-orange-bg); color: var(--tone-orange); }

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.1;
}

.stat-label {
  font-size: 0.74rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
  margin-top: 3px;
}

/* ==========================================================================
   Tables
   ========================================================================== */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  min-width: 720px;
}

.data-table th {
  text-align: left;
  font-size: 0.68rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  padding: 0.75rem 1rem;
  background: var(--bg-app);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr {
  transition: background 0.14s;
}

.data-table tbody tr:hover {
  background: #fafbfe;
}

.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cell-strong {
  font-weight: 600;
  color: var(--navy);
}

.cell-sub {
  display: block;
  font-size: 0.74rem;
  color: var(--muted);
  margin-top: 2px;
}

.cell-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  letter-spacing: -0.01em;
}

.row-actions {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
  white-space: nowrap;
}

/* ==========================================================================
   Badges + chips
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.71rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge i { font-size: 0.68rem; }

.badge-green  { background: var(--tone-green-bg);  color: var(--tone-green); }
.badge-teal   { background: var(--tone-teal-bg);   color: var(--tone-teal); }
.badge-amber  { background: var(--tone-amber-bg);  color: var(--tone-amber); }
.badge-orange { background: var(--tone-orange-bg); color: var(--tone-orange); }
.badge-red    { background: var(--tone-red-bg);    color: var(--tone-red); }
.badge-blue   { background: var(--tone-blue-bg);   color: var(--tone-blue); }
.badge-grey   { background: var(--tone-grey-bg);   color: var(--tone-grey); }

/* ==========================================================================
   Filters
   ========================================================================== */

.filters {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  align-items: center;
}

.filters .search {
  position: relative;
  flex: 1 1 240px;
  min-width: 200px;
}

.filters .search i {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.85rem;
  pointer-events: none;
}

.filters .search input {
  width: 100%;
  font-family: inherit;
  font-size: 0.86rem;
  padding: 10px 14px 10px 36px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--ink);
}

.filters .search input:focus {
  outline: none;
  border-color: var(--blue-bright);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

.filters select {
  font-family: inherit;
  font-size: 0.84rem;
  padding: 10px 34px 10px 13px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--ink);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23475467'%3E%3Cpath d='M8 11.5 2.5 6h11z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 11px;
  cursor: pointer;
}

.filters select:focus {
  outline: none;
  border-color: var(--blue-bright);
}

/* ==========================================================================
   Service picker
   ========================================================================== */

.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.picker-card {
  border: 1.5px solid var(--line);
  border-radius: var(--card-radius);
  background: var(--white);
  padding: 1.1rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  font-family: inherit;
  width: 100%;
}

.picker-card:hover {
  border-color: var(--blue);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.picker-card.selected {
  border-color: var(--blue);
  background: var(--tone-blue-bg);
  box-shadow: var(--shadow-md);
}

.picker-card img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.picker-card .picker-fallback {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--tone-blue-bg);
  color: var(--blue);
  font-size: 1.35rem;
}

.picker-card h3 {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.35;
}

.picker-price {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--blue);
}

.picker-tat {
  font-size: 0.7rem;
  color: var(--muted);
}

/* ==========================================================================
   Forms in the app (apply page, admin dialogs)
   ========================================================================== */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem 1.15rem;
}

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

.form-section {
  margin-top: 1.5rem;
}

.form-section:first-child {
  margin-top: 0;
}

.form-section > h3 {
  font-size: 0.8rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--navy);
  font-weight: 700;
  padding-bottom: 0.6rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.form-actions {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 1.6rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}

.field.invalid input,
.field.invalid select,
.field.invalid textarea {
  border-color: var(--red);
}

.field-error {
  margin-top: 5px;
  font-size: 0.74rem;
  color: var(--red);
  font-weight: 500;
}

/* File upload ----------------------------------------------------------- */

.upload {
  border: 1.5px dashed #c3cddf;
  border-radius: var(--radius);
  background: #fbfcfe;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  transition: border-color 0.18s, background 0.18s;
}

.upload:hover,
.upload.dragging {
  border-color: var(--blue);
  background: var(--tone-blue-bg);
}

.upload i {
  font-size: 1.3rem;
  color: var(--blue);
}

.upload-text {
  flex: 1;
  min-width: 0;
}

.upload-text strong {
  display: block;
  font-size: 0.85rem;
  color: var(--navy);
  font-weight: 600;
}

.upload-text span {
  display: block;
  font-size: 0.74rem;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload input[type="file"] {
  display: none;
}

.upload.has-file {
  border-style: solid;
  border-color: var(--tone-green);
  background: var(--tone-green-bg);
}

.upload.has-file i {
  color: var(--tone-green);
}

/* ==========================================================================
   Detail view (application drawer contents)
   ========================================================================== */

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.9rem 1.4rem;
}

.detail-item dt {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 3px;
}

.detail-item dd {
  font-size: 0.88rem;
  color: var(--ink);
  word-break: break-word;
}

.detail-block {
  margin-top: 1.4rem;
}

.detail-block > h3 {
  font-size: 0.76rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--navy);
  font-weight: 700;
  margin-bottom: 0.7rem;
}

.doc-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.doc-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  font-size: 0.83rem;
}

.doc-item i { color: var(--blue); }

.doc-item .doc-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-item a {
  color: var(--blue);
  font-weight: 600;
  font-size: 0.78rem;
}

.doc-item a:hover { text-decoration: underline; }

.timeline {
  border-left: 2px solid var(--line);
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.timeline-item {
  position: relative;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.47rem;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 3px var(--white);
}

.timeline-item time {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 2px;
}

.timeline-item p {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

.notice {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  font-size: 0.83rem;
  line-height: 1.6;
  margin-bottom: 1.1rem;
}

.notice i { margin-top: 3px; }

.notice-warn {
  background: var(--tone-orange-bg);
  color: #8a3208;
  border: 1px solid rgba(194, 65, 12, 0.2);
}

.notice-info {
  background: var(--tone-blue-bg);
  color: var(--navy);
  border: 1px solid rgba(21, 83, 201, 0.18);
}

.notice-ok {
  background: var(--tone-green-bg);
  color: #0a6b3d;
  border: 1px solid rgba(15, 157, 88, 0.22);
}

/* ==========================================================================
   Empty + loading states
   ========================================================================== */

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--muted);
}

.empty-state i {
  font-size: 2.2rem;
  color: #c3cddf;
  margin-bottom: 0.8rem;
}

.empty-state h3 {
  font-size: 0.98rem;
  color: var(--navy);
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.empty-state p {
  font-size: 0.85rem;
  max-width: 380px;
  margin: 0 auto 1.1rem;
  line-height: 1.65;
}

.loading-row {
  padding: 2.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.86rem;
}

.loading-row i {
  color: var(--blue);
  margin-right: 0.5rem;
}

.skeleton {
  background: linear-gradient(90deg, #eef1f6 25%, #f7f9fc 50%, #eef1f6 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: 6px;
  height: 14px;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ==========================================================================
   Tabs
   ========================================================================== */

.tabs {
  display: flex;
  gap: 0.3rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.3rem;
  overflow-x: auto;
}

.tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.7rem 1rem;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.18s, border-color 0.18s;
}

.tab:hover { color: var(--navy); }

.tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.tab-panel[hidden] { display: none; }

/* ==========================================================================
   Pagination
   ========================================================================== */

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.2rem;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.pager-buttons {
  display: flex;
  gap: 0.4rem;
}

/* ==========================================================================
   Toast
   ========================================================================== */

.toast-host {
  position: fixed;
  bottom: 1.2rem;
  right: 1.2rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: min(380px, calc(100vw - 2.4rem));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: var(--navy);
  color: var(--white);
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(11, 47, 116, 0.3);
  font-size: 0.85rem;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.22s, transform 0.22s;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast i { margin-top: 2px; }
.toast-success { background: #0b6b41; }
.toast-error   { background: #a5271a; }

/* ==========================================================================
   Modal
   ========================================================================== */

body.modal-open { overflow: hidden; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 47, 116, 0.42);
  backdrop-filter: blur(3px);
  z-index: 900;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4vh 1rem;
  overflow-y: auto;
  animation: fade-in 0.16s ease-out;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--white);
  border-radius: var(--card-radius);
  width: min(560px, 100%);
  box-shadow: 0 24px 60px rgba(11, 47, 116, 0.32);
  animation: rise 0.2s ease-out;
  margin: auto 0;
}

.modal.wide { width: min(860px, 100%); }

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.3rem;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  font-size: 1rem;
  color: var(--navy);
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.05rem;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.18s, color 0.18s;
}

.modal-close:hover {
  background: var(--tone-red-bg);
  color: var(--tone-red);
}

.modal-body {
  padding: 1.3rem;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-lede {
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 1.1rem;
}

.modal-lede a { color: var(--blue); font-weight: 600; }

.modal-foot {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  padding: 1rem 1.3rem;
  border-top: 1px solid var(--line);
  background: var(--bg-app);
  border-radius: 0 0 var(--card-radius) var(--card-radius);
  flex-wrap: wrap;
}

.confirm-text {
  font-size: 0.92rem;
  color: var(--ink);
  line-height: 1.65;
}

.credential-box {
  background: var(--bg-app);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin: 1rem 0;
}

.credential-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
}

.credential-row + .credential-row {
  border-top: 1px dashed var(--line);
}

.credential-row span {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.credential-row code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--navy);
  user-select: all;
  word-break: break-all;
  text-align: right;
}

/* ==========================================================================
   Standalone auth pages (reset password)
   ========================================================================== */

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background: var(--bg-app);
}

.auth-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-md);
  width: min(440px, 100%);
  padding: 2rem 1.8rem;
}

.auth-card .auth-logo {
  width: 62px;
  margin: 0 auto 1rem;
}

.auth-card h1 {
  font-size: 1.15rem;
  color: var(--navy);
  text-align: center;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

.auth-card .auth-lede {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.auth-card .field + .field { margin-top: 1rem; }

.auth-back {
  display: block;
  text-align: center;
  margin-top: 1.2rem;
  font-size: 0.82rem;
  color: var(--blue);
  font-weight: 600;
}

.auth-back:hover { text-decoration: underline; }

/* ==========================================================================
   Utilities
   ========================================================================== */

.text-muted { color: var(--muted); }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.75rem; }
.mt-2 { margin-top: 1.25rem; }
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1024px) {
  .app {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--side-w);
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.24s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.28);
  }

  .app.sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  .app.sidebar-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(11, 47, 116, 0.4);
    z-index: 55;
  }

  .topbar-toggle { display: block; }
}

@media (max-width: 700px) {
  .app-content { padding: 1.1rem 1rem 2.5rem; }
  .app-topbar  { padding: 0.75rem 1rem; }
  .user-chip-text { display: none; }
  .user-chip { padding: 4px; border: none; background: none; }
  .page-head h1 { font-size: 1.15rem; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.7rem; }
  .stat-card { padding: 0.85rem 0.9rem; gap: 0.7rem; }
  .stat-icon { width: 38px; height: 38px; font-size: 0.9rem; }
  .stat-value { font-size: 1.25rem; }
  .modal-foot { justify-content: stretch; }
  .modal-foot > * { flex: 1; }
  .form-actions > * { flex: 1; }
}

@media print {
  .app-sidebar, .app-topbar, .page-head-actions, .row-actions, .filters, .toast-host {
    display: none !important;
  }
  .app { grid-template-columns: 1fr; }
  .card { box-shadow: none; border-color: #ccc; }
}
