:root {
  font-family: Arial, "Leelawadee UI", sans-serif;
  color: #17232e;
  background: #f2f4f6;
  font-size: 16px;
  --red: #b50020;
  --line: #dce2e8;
  --muted: #586777;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  overflow-wrap: anywhere;
}
nav { overflow-x: auto; max-width: 100%; }
nav > * { flex-shrink: 0; white-space: nowrap; }
.toolbar { flex-wrap: wrap; }
.toolbar > label { flex: 1 1 140px; min-width: 0; }
.team-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; margin-bottom: 24px; }
.table-wrap { width: 100%; max-width: 100%; overflow-x: auto; }
.grid > *, .main, .panel { min-width: 0; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; }
select[multiple] { min-height: 132px; }
input[type=checkbox] { width: 22px; min-height: 22px; vertical-align: middle; }
details { padding: 14px 0; border-bottom: 1px solid var(--line); }
summary { cursor: pointer; min-height: 44px; font-weight: bold; }
#new-form { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px 20px; }
#new-form > .grid, #new-form > #equipment-pick { grid-column: 1/-1; }
@media(max-width: 650px) {
 .team-grid,#new-form { grid-template-columns: minmax(0,1fr); }
 .phone header { gap: 12px; padding: 16px; }
 .phone header img { width: 90px; }
 .phone header strong { font-size: 12px; }
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select {
  min-height: 44px;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 16px;
  background: white;
  color: inherit;
}
button:hover {
  border-color: #b50020;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.primary {
  background: var(--red);
  color: white;
  border-color: var(--red);
}
a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 6px;
}
a:hover,
.selected {
  background: #fae9ed;
  color: var(--red);
}
header {
  background: white;
  border-bottom: 1px solid var(--line);
  padding: 20px 30px;
  display: flex;
  align-items: center;
  gap: 24px;
}
header img {
  width: 130px;
  height: auto;
}
.brand {
  font-size: 14px;
  line-height: 1.5;
  font-weight: 700;
  border-left: 1px solid var(--line);
  padding-left: 24px;
  max-width: 240px;
}
.env {
  margin-left: auto;
  font-size: 13px;
  background: #fff4d8;
  padding: 7px 12px;
  border-radius: 5px;
  color: #765500;
}
nav {
  background: white;
  border-bottom: 1px solid var(--line);
  padding: 8px 24px;
  display: flex;
  gap: 8px;
  align-items: center;
}
nav button {
  margin-left: auto;
}
.main {
  max-width: 1450px;
  margin: auto;
  padding: 30px;
}
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
h1 {
  font-size: 30px;
  margin: 0 0 8px;
  letter-spacing: -0.8px;
}
h2 {
  font-size: 21px;
  margin: 0 0 18px;
}
h3 {
  font-size: 17px;
  margin: 0 0 8px;
}
p {
  line-height: 1.65;
}
.muted {
  color: var(--muted);
  font-size: 14px;
}
.kpis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.kpi {
  text-align: left;
  padding: 20px;
  border-top: 3px solid #aab6c0;
}
.kpi strong {
  display: block;
  font-size: 34px;
  margin-top: 13px;
}
.kpi.red {
  border-top-color: var(--red);
}
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.toolbar input {
  flex: 1;
  min-width: 180px;
}
.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}
.table-wrap {
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
th {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  background: #f7f9fa;
}
td,
th {
  padding: 15px 12px;
  border-bottom: 1px solid #edf0f3;
}
td {
  font-size: 14px;
  line-height: 1.6;
}
td:first-child {
  min-width: 260px;
  max-width: 420px;
}
td button {
  display: block;
  text-align: left;
  border: 0;
  padding: 0;
  background: none;
  color: #17232e;
  font-weight: 600;
}
td small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.badge {
  display: inline-block;
  border-radius: 5px;
  background: #edf2f6;
  padding: 5px 9px;
  font-size: 13px;
  white-space: nowrap;
}
.badge.waiting {
  background: #fff1cb;
  color: #705100;
}
.badge.closed,
.badge.completed {
  background: #e0f1e9;
  color: #176442;
}
.badge.awaiting_approval {
  background: #e9e5fa;
  color: #594395;
}
.badge.problem,
.overdue {
  color: #b50020;
}
.progress {
  height: 5px;
  background: #e7edf1;
  border-radius: 9px;
  width: 110px;
  margin-top: 8px;
  overflow: hidden;
}
.progress i {
  height: 100%;
  display: block;
  background: var(--red);
}
.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 20px;
}
label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin: 16px 0 7px;
}
input,
select,
textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #bdc8d2;
  border-radius: 7px;
  background: white;
  color: #17232e;
}
textarea {
  min-height: 100px;
  resize: vertical;
}
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
  flex-wrap: wrap;
}
dialog {
  border: 0;
  border-radius: 14px;
  width: min(850px, 94vw);
  max-height: 90vh;
  padding: 30px;
  box-shadow: 0 25px 100px #13263844;
}
dialog::backdrop {
  background: #13263888;
}
.check {
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 400;
}
.check input {
  width: 20px;
  min-height: 20px;
}
.unit {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.unit .top {
  margin: 0;
}
.login {
  max-width: 430px;
  margin: 8vh auto;
  background: white;
  border: 1px solid var(--line);
  border-top: 5px solid var(--red);
  padding: 34px;
  border-radius: 12px;
}
.login img {
  width: 170px;
  margin-bottom: 30px;
}
.login h1 {
  font-size: 25px;
}
.login button {
  width: 100%;
  margin-top: 25px;
}
#toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90vw;
  padding: 14px 22px;
  background: #17232e;
  color: white;
  border-radius: 9px;
  display: none;
  z-index: 10;
}
.phone {
  max-width: 480px;
  margin: auto;
}
.phone header {
  padding: 20px 16px;
  gap: 15px;
}
.phone header img {
  width: 95px;
}
.phone .brand {
  padding-left: 15px;
  font-size: 12px;
}
.phone .main {
  padding: 20px 16px;
}
.phone .top {
  align-items: flex-start;
}
.phone .kpis {
  grid-template-columns: repeat(2, 1fr);
}
.phone .kpi {
  padding: 15px;
}
.job-card {
  background: white;
  padding: 20px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--red);
  border-radius: 10px;
  margin: 12px 0;
}
.job-card button {
  width: 100%;
  margin-top: 16px;
}
.notice {
  background: #fff7e4;
  border-left: 3px solid #c79100;
  padding: 13px 16px;
  font-size: 14px;
  line-height: 1.6;
}
.empty {
  text-align: center;
  padding: 50px;
  color: var(--muted);
}
pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.6;
  background: #f4f6f8;
  padding: 16px;
  border-radius: 8px;
}
.message {
  background: #e7f4e9;
  padding: 20px;
  border-radius: 14px 14px 0 14px;
  white-space: pre-wrap;
  line-height: 1.7;
}
footer {
  color: var(--muted);
  font-size: 12px;
  margin-top: 30px;
}
.error {
  color: #b50020;
}
.login .muted {
  margin-top: 20px;
}
@media (max-width: 760px) {
  header {
    padding: 16px;
    gap: 14px;
  }
  .brand {
    font-size: 12px;
    padding-left: 14px;
  }
  header img {
    width: 100px;
  }
  .main {
    padding: 20px 14px;
  }
  .kpis {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid {
    grid-template-columns: 1fr;
  }
  nav {
    padding: 8px;
    overflow-x: auto;
    white-space: nowrap;
  }
  .top {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  h1 {
    font-size: 26px;
  }
  dialog {
    padding: 20px;
  }
  .env {
    font-size: 12px;
  }
  .panel {
    padding: 16px;
  }
}
.request-menu { display:block; padding:16px; border-radius:10px; background:#b40021; color:white; text-align:center; font-weight:700; text-decoration:none; }
.request-time { display:flex; align-items:center; gap:12px; }
.request-time label { flex:1; min-width:0; }
#request fieldset { border:1px solid #cbd5e1; border-radius:10px; margin:16px 0; padding:12px; min-width:0; }
#request .muted { line-height:1.65; }
