:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #18202a;
  --muted: #667085;
  --line: #d9dee7;
  --primary: #146c61;
  --primary-dark: #0d4e47;
  --danger: #b42318;
  --warn: #a15c07;
  --ok: #157f3b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

a {
  color: var(--primary-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  min-height: 56px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.brand {
  font-weight: 700;
}

.nav {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: calc(100vh - 56px);
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #eef2f5;
  padding: 20px;
}

.sidebar a {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text);
}

.sidebar a:hover {
  background: #dfe7ea;
  text-decoration: none;
}

.main,
.single {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 28px 24px 48px;
}

.single {
  max-width: 760px;
}

.single.office-wide {
  width: min(1840px, calc(100vw - 32px));
  max-width: none;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  margin: 0 0 20px;
}

.stack {
  display: grid;
  gap: 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

h1,
h2,
h3 {
  letter-spacing: 0;
  line-height: 1.3;
  margin: 0 0 16px;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 19px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid #bdc5d1;
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  background: #fff;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

button,
.button {
  border: 1px solid var(--primary);
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  min-height: 40px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
}

.button.secondary,
button.secondary {
  background: #fff;
  color: var(--primary-dark);
}

.button.danger,
button.danger {
  border-color: var(--danger);
  background: var(--danger);
}

.button.warn,
button.warn {
  border-color: var(--warn);
  background: var(--warn);
}

.inline {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.error {
  border: 1px solid #f5b5af;
  background: #fff4f2;
  color: var(--danger);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.notice {
  border: 1px solid #bfd8d1;
  background: #eff8f5;
  color: var(--primary-dark);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.otp-display {
  font-size: 28px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: 0;
  margin-top: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  color: #344054;
  font-size: 13px;
  background: #f0f3f6;
}

.status {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  background: #e8eef2;
  color: #344054;
  white-space: nowrap;
}

.status.CANCEL_REQUESTED {
  background: #fff3d6;
  color: #7a4b00;
}

.status.CANCELLED,
.status.REJECTED {
  background: #ffe3df;
  color: var(--danger);
}

.status.PDF_ISSUED,
.status.FAX_RECEIVED,
.status.REGISTERED_IN_BUSINESS_PC {
  background: #ddf4e6;
  color: var(--ok);
}

.muted {
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab-bar {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  margin: 0 0 16px;
}

.tab-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: #eef2f5;
  color: var(--text);
  font-weight: 700;
}

.tab-link:hover {
  text-decoration: none;
  background: #e4ebef;
}

.tab-link.active {
  background: #fff;
  color: var(--primary-dark);
  border-color: var(--line);
  margin-bottom: -1px;
}

.check-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.edit-table th,
.edit-table td {
  padding: 6px 6px;
  vertical-align: middle;
}

.edit-table input {
  min-height: 34px;
  padding: 5px 7px;
}

.key-cell {
  font-weight: 700;
  white-space: nowrap;
}

.order-input {
  width: 78px;
}

.account-edit-table th:first-child,
.account-edit-table td:first-child {
  width: 160px;
}

.account-edit-table th:nth-child(3),
.account-edit-table td:nth-child(3) {
  width: 170px;
}

.account-edit-table th:nth-child(4),
.account-edit-table td:nth-child(4),
.account-edit-table th:nth-child(5),
.account-edit-table td:nth-child(5) {
  width: 88px;
}

.range-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(64px, 1fr));
  gap: 6px;
}

.compact-rules {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 6px;
}

.compact-rules label {
  gap: 3px;
  font-size: 13px;
}

.email-edit-list {
  display: grid;
  gap: 5px;
}

.email-edit-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.organization-edit-table th:first-child,
.organization-edit-table td:first-child {
  width: 90px;
}

.compact-form input {
  width: auto;
  min-width: 130px;
}

.rule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.bulk-table-wrap {
  overflow-x: auto;
}

.bulk-table th,
.bulk-table td {
  min-width: 96px;
}

.yearly-table th:first-child,
.yearly-table td:first-child {
  min-width: 150px;
  width: 150px;
}

.yearly-table th:nth-child(2),
.yearly-table td:nth-child(2) {
  min-width: 82px;
  width: 82px;
}

.yearly-table th:nth-child(n + 3),
.yearly-table td:nth-child(n + 3) {
  min-width: 70px;
  width: 70px;
  padding-left: 4px;
  padding-right: 4px;
}

.capacity-input {
  width: 100%;
  min-height: 32px;
  padding: 5px 6px;
}

.yearly-capacity-input {
  min-width: 58px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(118px, 1fr));
  border: 1px solid var(--line);
  overflow-x: auto;
}

.calendar-head {
  background: #f0f3f6;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 8px;
  font-weight: 700;
  text-align: center;
}

.calendar-cell {
  min-height: 96px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 5px;
  background: #fff;
}

.calendar-cell.empty {
  background: #f6f7f9;
}

.calendar-date {
  font-weight: 700;
  margin-bottom: 4px;
  font-size: 13px;
}

.calendar-period {
  display: grid;
  grid-template-columns: 32px minmax(44px, 1fr) 34px;
  gap: 4px;
  align-items: center;
  padding: 3px 0;
  border-top: 1px solid #edf0f4;
}

.period-label,
.used-count {
  font-size: 12px;
  white-space: nowrap;
}

.used-count {
  color: var(--muted);
}

.monthly-capacity-input {
  min-height: 28px;
  padding: 3px 5px;
}

.application-board {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.category-list {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.category-title,
.category-option {
  display: block;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.category-title {
  font-weight: 700;
  background: #f0f3f6;
}

.category-option {
  color: var(--text);
}

.category-option.selected {
  background: #e6f2ef;
  color: var(--primary-dark);
  font-weight: 700;
}

.schedule-panel {
  min-width: 0;
}

.schedule-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.month-switcher {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  width: max-content;
}

.month-switcher input[type="month"] {
  width: 210px;
}

.month-switcher button {
  white-space: nowrap;
}

.application-draft-summary {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  min-height: 38px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 12px;
}

.application-draft-item {
  border: 1px solid #b8d4ca;
  border-radius: 999px;
  background: #e8f4ef;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 700;
  padding: 3px 9px;
  white-space: nowrap;
}

.application-draft-empty {
  color: var(--muted);
  font-size: 13px;
}

.date-blocks {
  display: grid;
  grid-template-columns: repeat(3, minmax(390px, 1fr));
  gap: 10px;
}

.office-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(92px, 1fr));
  border-top: 1px solid #202833;
  border-left: 1px solid #202833;
  background: #fff;
}

.office-calendar-head {
  min-height: 26px;
  padding: 3px 4px;
  border-right: 1px solid #202833;
  border-bottom: 1px solid #202833;
  background: #f0f3f6;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.office-calendar-day {
  min-height: 76px;
  padding: 4px;
  border-right: 1px solid #202833;
  border-bottom: 1px solid #202833;
}

.office-calendar-day.empty {
  background: #f6f7f9;
}

.office-calendar-date {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 3px;
}

.office-calendar-period {
  display: grid;
  grid-template-columns: 30px 38px minmax(42px, 1fr);
  gap: 3px;
  align-items: center;
  min-height: 24px;
  font-size: 12px;
}

.office-calendar-period-head {
  display: grid;
  grid-template-columns: 30px 38px minmax(42px, 1fr);
  gap: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.1;
  margin-bottom: 1px;
}

.office-calendar-period input {
  min-width: 0;
  min-height: 24px;
  padding: 2px 4px;
  text-align: right;
}

.office-remaining {
  color: var(--muted);
  text-align: right;
}

.schedule-table th,
.schedule-table td {
  border: 1px solid #202833;
  text-align: center;
}

.schedule-table input {
  min-width: 72px;
}

.board-actions {
  margin-top: 12px;
}

@media (max-width: 800px) {
  .topbar {
    padding: 12px 16px;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .layout {
    display: block;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .main,
  .single {
    padding: 20px 14px 36px;
  }

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

  .application-board {
    grid-template-columns: 1fr;
  }

  .schedule-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .date-blocks {
    grid-template-columns: 1fr;
  }

  .office-calendar-grid {
    grid-template-columns: repeat(7, minmax(92px, 1fr));
    overflow-x: auto;
  }

  .calendar-grid {
    grid-template-columns: repeat(7, minmax(120px, 1fr));
  }
}
