:root {
  color-scheme: light;
  font-family: Pretendard, "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  color: #222b35;
  background: #f3f5f7;
  font-size: 14px;
  font-weight: 400;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; }
button, th, td, .brand, .top h1 { white-space: nowrap; }

h1, h2, h3 {
  margin: 0;
  color: #1f3347;
  font-weight: 500;
}
h1 { font-size: 23px; line-height: 1.3; }
h2 { font-size: 19px; line-height: 1.3; }
h3 { font-size: 14px; }

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.panel {
  background: #fff;
  border: 1px solid #d8dee6;
  border-radius: 0;
  box-shadow: none;
}
.login .panel { width: min(380px, 100%); padding: 26px; }
.login h1 { margin-bottom: 18px; }

label {
  display: grid;
  gap: 5px;
  margin: 11px 0;
  color: #364757;
  font-size: 13px;
  font-weight: 400;
}
input, select {
  width: 100%;
  height: 36px;
  padding: 7px 9px;
  border: 1px solid #bcc7d2;
  border-radius: 0;
  background: #fff;
  color: #222b35;
  font-size: 13px;
  outline: none;
}
input:focus, select:focus {
  border-color: #25618f;
  box-shadow: inset 0 0 0 1px #25618f;
}

button {
  min-height: 34px;
  border: 1px solid #20567f;
  border-radius: 0;
  padding: 7px 12px;
  background: #205f8e;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
}
button:hover { background: #184d74; }
button.secondary {
  border-color: #aebac6;
  background: #fff;
  color: #33495d;
}
button.secondary:hover { background: #edf1f4; }
button.small { min-height: 28px; padding: 4px 8px; font-size: 12px; }
button:disabled { cursor: not-allowed; opacity: .42; }

.error { min-height: 18px; margin: 6px 0; color: #b42318; font-size: 12px; }
.notice { min-height: 18px; margin: 6px 0; color: #176b3a; font-size: 12px; }
.muted { color: #718096; font-size: 13px; }

.layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  min-height: 100vh;
}
aside {
  background: #173650;
  color: #fff;
  padding: 18px 12px;
}
.brand {
  padding: 0 8px 18px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -.2px;
}
nav button {
  display: block;
  width: 100%;
  min-height: 36px;
  margin: 1px 0;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  text-align: left;
  font-weight: 400;
}
nav button.active, nav button:hover { background: #284c69; }

.content { min-width: 0; padding: 22px 24px; overflow: auto; }
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}
.top h1 { margin-bottom: 5px; }
.top-actions, .dialog-actions { display: flex; gap: 6px; justify-content: flex-end; flex: 0 0 auto; }

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.card { min-height: 86px; padding: 14px; }
.card small { color: #718096; font-size: 12px; }
.card strong {
  display: block;
  margin-top: 7px;
  color: #1f3347;
  font-size: 22px;
  font-weight: 500;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.search-form { display: flex; gap: 5px; flex: 1; max-width: 620px; }
.search-form input { min-width: 210px; }
.search-form select { width: 130px; }

.table-panel { width: 100%; overflow: auto; }
table { width: 100%; min-width: 760px; border-collapse: collapse; }

/* Dashboard: keep every column title on one line with stable widths. */
.dashboard-work-table {
  width: 100%;
  min-width: 1050px;
  table-layout: fixed;
}
.dashboard-work-table th,
.dashboard-work-table td,
.dashboard-work-table th button {
  white-space: nowrap !important;
}
.dashboard-work-table th {
  overflow: hidden;
  text-overflow: ellipsis;
}
.dashboard-work-table .dashboard-col-order { width: 170px; }
.dashboard-work-table .dashboard-col-customer { width: 105px; }
.dashboard-work-table .dashboard-col-product { width: 220px; }
.dashboard-work-table .dashboard-col-assigned { width: 110px; }
.dashboard-work-table .dashboard-col-visit { width: 120px; }
.dashboard-work-table .dashboard-col-completed { width: 120px; }
.dashboard-work-table .dashboard-col-assignee { width: 130px; }
.dashboard-work-table .dashboard-col-status { width: 105px; }
.dashboard-work-table .dashboard-col-settlement { width: 120px; }
th {
  height: 38px;
  padding: 8px 10px;
  border-bottom: 1px solid #cfd7df;
  background: #e9edf1;
  color: #405163;
  font-size: 12px;
  font-weight: 500;
  text-align: left;
}
td {
  max-width: 280px;
  padding: 9px 10px;
  border-top: 1px solid #e1e6eb;
  color: #2c3742;
  font-size: 13px;
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
}
td strong { font-weight: 500; }
td small, .member-list small {
  display: block;
  margin-top: 3px;
  color: #718096;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.member-list > div + div { margin-top: 6px; }
.badge {
  display: inline-block;
  padding: 3px 6px;
  border: 1px solid #b9cbd9;
  border-radius: 0;
  background: #edf4f8;
  color: #245a83;
  font-size: 11px;
  font-weight: 400;
}
.status-active { border-color: #acd1bb; background: #edf7f1; color: #176b3a; }
.status-pending { border-color: #dec78f; background: #fff8e8; color: #7a5200; }
.status-suspended, .status-closed { border-color: #dfb5b1; background: #fbeeed; color: #94372f; }

dialog {
  width: min(440px, calc(100% - 28px));
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: auto;
  border: 1px solid #aeb9c4;
  border-radius: 0;
  box-shadow: 0 12px 32px rgba(20, 39, 56, .22);
}
.wide-dialog { width: min(780px, calc(100% - 28px)); }
dialog::backdrop { background: rgba(18, 31, 43, .48); }
.password-form, .installer-form { padding: 22px; }
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid #d9e0e6;
}
.icon-button {
  min-height: auto;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: #536474;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
}
.icon-button:hover { background: transparent; color: #1f3347; }
.installer-form h3 { margin: 18px 0 3px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.span-2 { grid-column: span 2; }
.form-help { margin: 3px 0; color: #718096; font-size: 12px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  aside { display: none; }
  .content { padding: 16px; }
  .cards { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .toolbar, .search-form { align-items: stretch; flex-direction: column; max-width: none; }
  .search-form input, .search-form select { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
}
