:root {
  --page: #f3f6fa;
  --surface: #fff;
  --text: #182230;
  --muted: #667085;
  --border: #d0d9e6;
  --primary: #3157d5;
  --primary-dark: #2445b7;
  --danger: #b42318;
  --radius: 12px;
  --shadow: 0 8px 28px rgb(30 50 80 / 8%);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--page);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 32px auto 56px;
}

.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  margin: 0 0 6px;
  font-size: 26px;
}

.page-header p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* Cards and responsive layout */
.card,
.phone-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.card {
  padding: 24px;
  margin-bottom: 20px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
  color: #344054;
  font-size: 15px;
  font-weight: 700;
}

.card-title::before {
  content: "";
  width: 4px;
  height: 18px;
  border-radius: 99px;
  background: var(--primary);
}

.grid,
.filter-grid {
  display: grid;
  gap: 18px;
}

.grid-menu {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

/*
.grid-form,
.grid-voucher {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
*/
.grid-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/*
.grid-voucher {
  max-width: 550px;
}
*/

.grid-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.content-layout {
  width: 100%;
}

.grid-layout .card {
  margin-bottom: 0;
}

.filter-card {
  position: sticky;
  top: 20px;
}

.filter-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  max-width: 720px;
}

/* Form controls and labels */
input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  transition: border-color .18s, box-shadow .18s;
}

input,
select {
  display: block;
  min-height: 52px;
  padding: 8px 14px;
}

textarea {
  display: block;
  min-height: 110px;
  padding: 16px 12px 12px;
  line-height: 1.5;
  resize: vertical;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #98a8bd;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgb(49 87 213 / 22%);
  outline-offset: 2px;
  border-color: var(--primary);
}

input[readonly],
select:disabled {
  background: #f8fafc;
  color: #475467;
}

.number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.input-error,
.input-invalid {
  border-color: var(--danger);
  background: #ffe5e5;
}

.input-valid {
  background: var(--surface);
}

.line,
.menu-row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
}

/* Buttons */
button {
  min-height: 44px;
  padding: 8px 20px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s, background .15s, border-color .15s, box-shadow .15s;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.primary,
.login-btn,
.filter-btn.primary {
  background: var(--primary);
  color: #fff;
}

.primary:hover,
.login-btn:hover,
.filter-btn.primary:hover {
  background: var(--primary-dark);
}

.secondary,
.filter-btn {
  border-color: var(--border);
}

.secondary:hover,
.filter-btn:hover {
  background: #f8fafc;
  border-color: #98a8bd;
}

.danger {
  margin-left: auto;
  color: var(--danger);
  border-color: #f2c7c3;
}

.danger:hover {
  background: #fff5f4;
}

.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.filter-btn {
  min-width: 120px;
}

/* Tables: use a scrolling wrapper on narrow screens */
.tableContainer,
.table-container,
.phone-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid #e8edf3;
  text-align: left;
}

/*
th {
  background: #f8fafc;
  color: #475467;
  font-weight: 600;
}
*/

th {
  background: #f8fafc;
  color: #475467;
  font-weight: 750;
}

.table-container {
  margin-left: 25px;
}

.phone-page {
  width: 100%;
  max-width: 1240px;
  margin: 32px auto;
  padding: 0 20px;
}

.phone-card {
  overflow: hidden;
}

.phone-heading {
  padding: 24px;
  border-bottom: 1px solid #e8edf3;
}

.phone-heading h1 {
  margin: 0;
  font-size: 22px;
}

.phone-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.phone-scroll:focus-visible {
  outline: 3px solid rgb(49 87 213 / 22%);
  outline-offset: -3px;
}

.transaction-table {
  min-width: 960px;
  font-size: 14px;
}

.transaction-table th,
.transaction-table td {
  text-align: center;
  white-space: nowrap;
}

.transaction-table tbody tr {
  transition: background .15s;
}

.transaction-table tbody tr:focus-within {
  background: #f8faff;
}

@media (hover: hover) {
  .transaction-table tbody tr:hover {
    background: #f8faff;
  }
}

.transaction-table input,
.transaction-table select {
  display: inline-block;
  width: 120px;
  min-height: 40px;
  padding: 8px 10px;
  text-align: center;
}

.transaction-table button {
  min-height: 40px;
  padding: 8px 14px;
  background: #eff6ff;
  color: #2563eb;
}

.transaction-table button:hover {
  background: #dbeafe;
}

.phone-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  vertical-align: middle;
}

.phone-icon .bi {
  font-size: 23px;
  line-height: 1;
}

.phone-icon--general {
  background: #eef2f6;
  color: #475569;
}

.phone-icon--paper {
  background: #eff6ff;
  color: #2563eb;
}

.phone-icon--food {
  background: #ecfdf3;
  color: #15803d;
}

.phone-icon--plastic {
  background: #f0fdfa;
  color: #0f766e;
}

/* News */
.News-container {
  max-width: 900px;
  margin: 40px auto;
  padding: 20px;
}

.news-card {
  overflow: hidden;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.news-image img {
  display: block;
  width: 100%;
  height: auto;
}

.news-content {
  padding: 20px;
}

.news-title {
  margin: 0 0 10px;
  font-size: 1.8rem;
}

.news-meta {
  margin-bottom: 15px;
  color: var(--muted);
  font-size: .9rem;
}

.news-text {
  width: 100%;
  line-height: 1.6;
  white-space: pre-line;
}

/* Navigation and older page components */
/*
.horizontalMenu {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
*/

/*
.horizontalMenu li a {
  display: block;
  padding: 12px 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}
*/

/*
.horizontalMenu li a:hover {
  background: #e0f0e0;
}
*/

/*
.navbar {
  display: flex;
  align-items: center;
  padding: 15px 30px;
}
*/

.filter-frame,
.menu-frame {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin: 20px 0 0 20px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.filter-frame::before,
.menu-frame::before {
  content: var(--title, "");
  position: absolute;
  top: -12px;
  left: 20px;
  padding: 0 6px;
  background: var(--surface);
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
}

/*
iframe {
  max-width: 100%;
}
*/

.left {
  text-align: left;
}

.center {
  text-align: center;
}

.right {
  text-align: right;
}

/*
.centerTable {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}
*/

.no-border {
  border: 0;
}

.one-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bold {
  font-weight: 600;
}

/*
.underscore {
  border-bottom: 1px solid currentColor;
}
*/

/* Login */
.login-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 20px;
}

.login-box {
  width: min(100%, 420px);
  padding: 35px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.login-box h2 {
  margin: 0 0 30px;
  text-align: center;
  color: var(--primary);
  font-size: 24px;
}

.login-btn {
  width: 100%;
  min-height: 50px;
}

@media (max-width: 850px) {

  .grid-menu,
  .grid-form,
  .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }
}

@media (max-width: 700px) {
  .grid-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .filter-card {
    position: static;
  }

  .phone-page {
    margin: 16px auto;
    padding: 0 12px;
  }
}

@media (max-width: 560px) {
  .page {
    width: calc(100% - 20px);
    margin-top: 18px;
  }

  .card {
    padding: 20px 16px;
  }

  .grid-menu,
  .grid-form,
  .filter-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .actions button {
    width: 100%;
    min-width: 0;
  }

  .danger,
  .table-container {
    margin-left: 0;
  }

  .news-title {
    font-size: 1.4rem;
  }
}

.error-message {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
  color: #344054;
  font-size: 15px;
  font-weight: 700;
}

/* Center the dialog vertically and horizontally */
dialog.centered-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  height: fit-content;
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}

/* Prevent .grid from displaying a closed dialog */
dialog.centered-dialog:not([open]) {
  display: none;
}

/* Field */
.field,
.filter-field {
  position: relative;
  min-width: 0;
}

/*
.text-field {
  grid-column: 1 / -1;
}
*/

/*
.field label {
  position: absolute;
  z-index: 1;
  top: -8px;
  left: 12px;
  padding: 0 6px;
  background: var(--surface);
  color: #475467;
  font-size: 12px;
  font-weight: 600;
}
*/

.field label {
  z-index: 1;
  left: 12px;
  padding: 0 6px;
  background: var(--surface);
  color: #475467;
  font-size: 14px;
  font-weight: 750;
}

.field:focus-within label {
  color: var(--primary);
}

.filter-field label {
  display: block;
  margin-bottom: 6px;
  color: #475569;
  font-weight: 600;
}

.field-position {
  width: min(250px, 100%);
  margin: 0 0 15px 35px;
}

.field-position-menu {
  margin: 0 0 5px 15px;
  text-align: center;
}

.field-position,
.field-position-menu {
  margin-left: 0;
}