body {
  margin: 0;
  font-family: "Segoe UI", Pretendard, Arial, sans-serif;
  background: #f5f7fb;
  color: #1c2130;
}

.container {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.card {
  width: min(680px, 100%);
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
  background: white;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 8px 24px rgba(17, 31, 50, 0.09);
}

.brand {
  width: 100%;
  text-align: center;
  display: block;
  margin-bottom: 8px;
  position: relative;
}

.brand-logo-wrap {
  position: relative;
  display: inline-block;
  margin: 0 auto;
}

.brand-logo {
  width: 180px;
  max-width: 65%;
  height: auto;
  object-fit: contain;
}

.admin-hotspot {
  position: fixed;
  top: 12px;
  right: 12px;
  width: 64px;
  height: 64px;
  transform: none;
  display: block;
  pointer-events: auto;
  opacity: 0;
  cursor: pointer;
  z-index: 50;
}

.admin-hotspot:focus-visible {
  opacity: 0.12;
  background: #000;
  outline: 2px solid #1f4cff;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-panel {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #e7ebf3;
}

.admin-panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.admin-panel h2 {
  margin: 0;
}

.inline {
  display: flex;
  gap: 8px;
}

h1 {
  margin-top: 0;
}

h2 {
  font-size: 16px;
}

h2 + label {
  margin-top: 12px;
}

h1,
h2 {
  margin-bottom: 8px;
}

h1 {
  margin-top: 0;
}

.muted {
  color: #5b6480;
}

label,
fieldset {
  display: block;
  margin-top: 14px;
}

input[type="tel"],
input[type="text"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  box-sizing: border-box;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid #cfd4df;
  border-radius: 8px;
  font-size: 16px;
}

fieldset {
  border: 1px solid #d9dce7;
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

fieldset label {
  margin: 0;
}

.actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

button,
.button-link {
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 16px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  background: #edf1fb;
  color: #263550;
  text-decoration: none;
}

button.primary {
  background: #1f4cff;
  color: white;
}

button:not(.primary) {
  background: #edf1fb;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.status {
  margin-top: 16px;
  min-height: 24px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #e4e8f3;
  background: #f8f9ff;
}

.ok {
  border-color: #9ce4b4;
  background: #effff2;
  color: #166b35;
}

.warn {
  border-color: #ffd38a;
  background: #fff8ea;
  color: #7a5800;
}

.error {
  border-color: #ffc0c0;
  background: #fff1f1;
  color: #8d1212;
}

.result-box {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #e6ebf6;
  background: #f1f4ff;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  overflow-x: hidden;
}

.admin-body {
  background: #f4f6fa;
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
}

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: 28px 18px 20px;
  background: #17233d;
  color: white;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 26px;
  color: white;
  text-decoration: none;
  font-size: 18px;
  font-weight: 700;
}

.admin-brand-logo {
  width: 72px;
  height: 36px;
  object-fit: contain;
  padding: 4px 7px;
  box-sizing: border-box;
  border-radius: 6px;
  background: white;
}

.admin-nav {
  display: grid;
  gap: 6px;
}

.admin-nav a {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 10px;
  padding: 13px 12px;
  border-radius: 8px;
  color: #dbe5fa;
  text-decoration: none;
}

.admin-nav a:hover,
.admin-nav a.active {
  background: #263654;
  color: white;
}

.admin-nav-icon {
  font-size: 21px;
  text-align: center;
}

.admin-nav strong,
.admin-nav small {
  display: block;
}

.admin-nav small {
  margin-top: 3px;
  color: #9eacc7;
  font-size: 12px;
}

.admin-sidebar-footer {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid #34415d;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.admin-sidebar-footer a,
.admin-sidebar-footer button {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 9px 8px;
  border-radius: 7px;
  background: #263654;
  color: white;
  text-decoration: none;
  font-size: 13px;
}

.admin-content {
  width: min(1180px, 100%);
  box-sizing: border-box;
  padding: 42px 48px;
}

.admin-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 26px;
}

.admin-page-header h1 {
  margin: 2px 0 6px;
  font-size: 30px;
  letter-spacing: -0.03em;
}

.admin-page-header p {
  margin: 0;
}

.admin-eyebrow {
  color: #4062a7;
  font-size: 13px;
  font-weight: 700;
}

.admin-page[hidden] {
  display: none;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.admin-section {
  min-width: 0;
  padding: 24px;
  border: 1px solid #e0e5ef;
  border-radius: 10px;
  background: white;
  box-shadow: 0 4px 14px rgba(30, 48, 79, 0.04);
}

.admin-section-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid #edf0f5;
}

.admin-section-heading h2,
.admin-section-heading p {
  margin: 0;
}

.admin-section-heading p {
  margin-top: 4px;
  font-size: 14px;
}

.section-number {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 28px;
  border-radius: 6px;
  background: #edf2ff;
  color: #3159ad;
  font-size: 12px;
  font-weight: 800;
}

.field-with-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.field-with-action button {
  white-space: nowrap;
}

.field-state {
  min-height: 20px;
  margin: 8px 0 0;
  color: #69738a;
  font-size: 13px;
}

.help-details {
  margin-top: 16px;
  padding: 10px 12px;
  border: 1px solid #e8ebf2;
  border-radius: 7px;
  background: #fafbfc;
  color: #556078;
  font-size: 13px;
}

.help-details p {
  margin-bottom: 0;
  line-height: 1.6;
}

.log-section {
  padding: 0;
  overflow: hidden;
}

.log-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 0;
  border-bottom: 1px solid #e7ebf2;
}

.log-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
}

.log-tabs button {
  flex: 0 0 auto;
  padding: 12px 14px 13px;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #69738a;
  white-space: nowrap;
}

.log-tabs button[aria-selected="true"] {
  border-bottom-color: #315fbd;
  color: #244f9f;
  font-weight: 700;
}

.log-tabs span {
  display: inline-block;
  min-width: 17px;
  margin-left: 4px;
  padding: 2px 5px;
  border-radius: 10px;
  background: #eef1f6;
  color: #637089;
  font-size: 11px;
}

.log-filters {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 120px;
  gap: 12px;
  padding: 18px 20px;
  background: #fafbfc;
}

.log-filters label {
  margin: 0;
  color: #59647a;
  font-size: 13px;
  font-weight: 600;
}

.log-filters input,
.log-filters select {
  background: white;
  font-weight: 400;
}

.log-table-wrap {
  min-height: 320px;
  overflow-x: auto;
}

.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.log-table th,
.log-table td {
  padding: 13px 16px;
  border-bottom: 1px solid #edf0f4;
  text-align: left;
  vertical-align: top;
}

.log-table th {
  background: #f8f9fb;
  color: #566078;
  font-size: 12px;
  white-space: nowrap;
}

.log-table td {
  max-width: 360px;
  overflow-wrap: anywhere;
}

.log-table tbody tr:hover {
  background: #fafcff;
}

.log-result {
  color: #3159ad;
  font-weight: 700;
}

.log-empty {
  padding: 90px 20px;
  color: #768095;
  text-align: center;
}

.log-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: #fafbfc;
}

.log-pagination p {
  margin: 0;
}

.app-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.app-summary-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 20px;
  border: 1px solid #e0e5ef;
  border-radius: 10px;
  background: white;
  box-shadow: 0 4px 14px rgba(30, 48, 79, 0.04);
}

.app-summary-label {
  color: #5f6a80;
  font-size: 13px;
  font-weight: 700;
}

.app-summary-card > strong {
  margin: 8px 0 3px;
  color: #17233d;
  font-size: 30px;
}

.app-summary-card > strong.summary-time {
  font-size: 23px;
}

.app-summary-card small {
  color: #8a93a5;
}

.app-status-section {
  margin-bottom: 18px;
}

.app-status-heading,
.app-status-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.app-status-heading {
  padding-bottom: 18px;
  border-bottom: 1px solid #edf0f5;
}

.app-status-heading h2,
.app-status-heading p {
  margin: 0;
}

.app-status-heading p {
  margin-top: 4px;
}

.test-sms-panel {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid #dce4f0;
  border-radius: 8px;
  background: #f7f9fc;
}

.test-sms-panel label {
  display: block;
  margin-bottom: 8px;
  color: #263550;
  font-size: 13px;
  font-weight: 700;
}

.test-sms-panel input {
  min-width: min(100%, 240px);
  flex: 1;
}

.test-sms-panel p {
  margin: 8px 0 0;
}

.app-status-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.app-status-card {
  padding: 18px;
  border: 1px solid #e0e5ef;
  border-left: 4px solid #9ca7b9;
  border-radius: 8px;
  background: #fafbfd;
}

.app-status-card.connected {
  border-left-color: #24a45a;
  background: #fbfffc;
}

.app-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.connection-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
}

.connection-dot.online {
  background: #24a45a;
  box-shadow: 0 0 0 4px rgba(36, 164, 90, 0.13);
}

.connection-dot.offline {
  background: #a4adbd;
}

.app-version,
.connection-badge {
  padding: 3px 7px;
  border-radius: 12px;
  font-size: 11px;
}

.app-version {
  background: #edf1f7;
  color: #667188;
}

.connection-badge {
  white-space: nowrap;
  font-weight: 700;
}

.connection-badge.online {
  background: #e6f8ec;
  color: #15723a;
}

.connection-badge.offline {
  background: #edf0f4;
  color: #657086;
}

.app-status-card code {
  color: #778197;
  font-size: 12px;
}

.app-status-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 18px;
  margin-top: 16px;
  padding-top: 15px;
  border-top: 1px solid #e8ebf1;
}

.app-status-metrics div {
  min-width: 0;
}

.app-status-metrics span,
.app-status-metrics strong {
  display: block;
}

.app-status-metrics span {
  margin-bottom: 4px;
  color: #828b9d;
  font-size: 11px;
}

.app-status-metrics strong {
  overflow-wrap: anywhere;
  color: #344057;
  font-size: 13px;
}

.app-status-empty {
  padding: 58px 20px 42px;
  color: #6d778c;
  text-align: center;
}

.app-status-empty .connection-dot {
  display: block;
  width: 12px;
  height: 12px;
  margin: 0 auto 14px;
}

.app-status-empty p {
  margin: 7px 0 0;
}

.app-guide ol {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 0;
  padding: 0;
  counter-reset: app-guide;
  list-style: none;
}

.app-guide li {
  position: relative;
  padding: 14px 14px 14px 44px;
  border: 1px solid #e8ebf2;
  border-radius: 7px;
  counter-increment: app-guide;
}

.app-guide li::before {
  content: counter(app-guide);
  position: absolute;
  top: 14px;
  left: 14px;
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #eaf0ff;
  color: #3159ad;
  font-size: 11px;
  font-weight: 800;
}

.app-guide li strong,
.app-guide li span {
  display: block;
}

.app-guide li span {
  margin-top: 4px;
  color: #657087;
  font-size: 13px;
  line-height: 1.5;
}

.admin-content > .status {
  position: fixed;
  top: 20px;
  right: 22px;
  z-index: 100;
  width: min(380px, calc(100vw - 32px));
  min-height: 0;
  box-sizing: border-box;
  margin: 0;
  padding: 13px 16px;
  border-radius: 9px;
  box-shadow: 0 12px 32px rgba(23, 35, 61, 0.2);
  opacity: 0;
  transform: translate3d(0, -14px, 0);
  visibility: hidden;
  pointer-events: none;
  transition: opacity 220ms ease, transform 280ms ease, visibility 280ms;
}

.admin-content > .status.toast-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  visibility: visible;
}

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; height: auto; padding: 16px; }
  .admin-brand { padding-bottom: 14px; }
  .admin-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .admin-sidebar-footer { margin-top: 14px; }
  .admin-content { padding: 28px 20px; }
  .settings-grid { grid-template-columns: 1fr; }
  .app-status-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .admin-nav small { display: none; }
  .admin-content { padding: 24px 14px; }
  .admin-page-header h1 { font-size: 26px; }
  .admin-section { padding: 18px; }
  .field-with-action { grid-template-columns: 1fr; }
  .log-toolbar { align-items: flex-start; padding: 12px 12px 0; }
  .log-filters { grid-template-columns: 1fr; padding: 14px; }
  .log-table-wrap { min-height: 260px; overflow: visible; }
  .log-table thead { display: none; }
  .log-table,
  .log-table tbody,
  .log-table tr,
  .log-table td { display: block; width: 100%; box-sizing: border-box; }
  .log-table tr { padding: 11px 14px; border-bottom: 1px solid #e7ebf2; }
  .log-table td { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 10px; max-width: none; padding: 5px 0; border: 0; }
  .log-table td::before { content: attr(data-label); color: #7a8498; font-size: 12px; font-weight: 700; }
  .log-pagination { align-items: flex-start; }
  .app-summary-grid { grid-template-columns: 1fr; }
  .app-summary-card { padding: 16px; }
  .app-status-heading { align-items: center; }
  .app-status-card-header { display: grid; }
  .app-status-metrics { grid-template-columns: 1fr 1fr; }
  .app-guide ol { grid-template-columns: 1fr; }
  .admin-content > .status { top: 12px; right: 12px; width: calc(100vw - 24px); }
}

@media (prefers-reduced-motion: reduce) {
  .admin-content > .status { transition-duration: 1ms; }
}
