:root {
  color-scheme: light;
  --ink: #1d2528;
  --muted: #647173;
  --line: #d8dfdc;
  --surface: #ffffff;
  --canvas: #f4f2ec;
  --sage: #527665;
  --sage-dark: #2f5144;
  --amber: #c08422;
  --coral: #b85745;
  --mint: #dcebe2;
  --gold: #f2e2bd;
  --rose: #f2ddd7;
  --shadow: 0 18px 45px rgba(30, 38, 34, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  font-family:
    Inter, Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  height: 100vh;
  padding: 24px 18px;
  background: #23322d;
  color: #f8f5ed;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--gold);
  color: #26362f;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 3px;
  color: rgba(248, 245, 237, 0.7);
  font-size: 0.83rem;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(248, 245, 237, 0.78);
  text-align: left;
  text-decoration: none;
}

.nav-item span:first-child {
  text-align: center;
  font-weight: 800;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.11);
  color: #ffffff;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: auto;
  padding: 14px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: rgba(248, 245, 237, 0.74);
  font-size: 0.88rem;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #8fd4a4;
}

.workspace {
  min-width: 0;
  padding: 30px clamp(18px, 3vw, 42px) 56px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 30px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--sage-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.45rem;
  letter-spacing: 0;
}

h3 {
  font-size: 1.02rem;
  letter-spacing: 0;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  width: min(100%, 560px);
}

.search-box {
  display: grid;
  grid-template-columns: 26px minmax(160px, 1fr);
  align-items: center;
  min-height: 44px;
  flex: 1 1 280px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.primary-action,
.secondary-action,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid transparent;
  text-decoration: none;
}

.primary-action {
  padding: 0 18px;
  background: var(--sage);
  color: #ffffff;
  font-weight: 700;
}

.primary-action:hover {
  background: var(--sage-dark);
}

.secondary-action {
  padding: 0 16px;
  background: #ffffff;
  border-color: var(--line);
  color: var(--ink);
}

.icon-button {
  display: grid;
  width: 42px;
  place-items: center;
  padding: 0;
  background: #ffffff;
  border-color: var(--line);
  color: var(--ink);
  font-size: 1.25rem;
}

.topbar-link {
  white-space: nowrap;
}

.content-section {
  display: none;
}

.content-section.active {
  display: block;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-heading p {
  margin-bottom: 0;
  color: var(--muted);
}

.segmented-control {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ece8dc;
}

.segmented-control button {
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.segmented-control button.active {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(41, 48, 43, 0.08);
}

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

.metric {
  min-height: 100px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metric-label {
  display: block;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

.metric strong {
  font-size: 2rem;
  line-height: 1;
}

.metric-date {
  display: block;
  font-size: 1.35rem;
  line-height: 1.15;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.service-card {
  display: grid;
  min-height: 236px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(40, 48, 44, 0.02);
}

.service-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.service-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.service-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  color: #28302c;
  font-weight: 900;
}

.service-icon.people {
  background: var(--mint);
}

.service-icon.sales {
  background: var(--gold);
}

.service-icon.ops {
  background: #d9e6ee;
}

.service-icon.finance {
  background: var(--rose);
}

.favorite-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--amber);
  font-size: 1.05rem;
}

.service-card h3 {
  margin: 14px 0 8px;
}

.service-card p {
  color: var(--muted);
  line-height: 1.55;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
}

.owner {
  color: var(--muted);
  font-size: 0.88rem;
}

.pill,
.admin-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
}

.pill.success {
  background: var(--mint);
  color: var(--sage-dark);
}

.pill.pending {
  background: var(--gold);
  color: #75500f;
}

.pill.warning {
  background: var(--rose);
  color: #7d3024;
}

.empty-state {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--muted);
  text-align: center;
}

.request-layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 16px;
}

.request-form,
.request-card,
.notice-item,
.admin-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.request-form {
  display: grid;
  gap: 14px;
  align-self: start;
  padding: 18px;
}

.request-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.request-form input,
.request-form select,
.request-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
  color: var(--ink);
  outline: 0;
}

.request-form input,
.request-form select {
  min-height: 44px;
  padding: 0 12px;
}

.request-form textarea {
  resize: vertical;
  min-height: 130px;
  padding: 12px;
}

.request-list,
.notice-list {
  display: grid;
  gap: 12px;
}

.request-card {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.request-card h3,
.notice-item h3 {
  margin-bottom: 3px;
}

.request-meta,
.notice-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.notice-item {
  padding: 18px;
}

.admin-badge {
  background: #d9e6ee;
  color: #2e4e5d;
}

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

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

.admin-tool-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-height: 92px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}

.admin-tool-card:hover {
  border-color: var(--sage);
  box-shadow: var(--shadow);
}

.admin-tool-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 8px;
  background: var(--mint);
  color: var(--sage-dark);
  font-weight: 900;
}

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

.admin-tool-card small {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.45;
}

.crawler-summary {
  grid-template-columns: 1fr 1fr minmax(180px, 0.8fr);
}

.crawler-table-wrap {
  border-color: #cbd8d3;
}

.crawler-table {
  min-width: 980px;
}

.crawler-table th:first-child {
  width: 42%;
}

.crawler-title {
  min-width: 360px;
  font-weight: 700;
  line-height: 1.45;
}

.dday {
  white-space: nowrap;
}

.source-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--sage-dark);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.source-link:hover {
  border-color: var(--sage);
  background: var(--mint);
}

.run-log {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.run-log-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.run-log-line {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px 14px;
  background: var(--canvas);
}

.auth-panel {
  width: min(100%, 460px);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-panel .brand {
  color: var(--ink);
}

.auth-panel .brand small {
  color: var(--muted);
}

.auth-panel h1 {
  margin: 28px 0 10px;
  font-size: 2rem;
}

.auth-panel p {
  color: var(--muted);
  line-height: 1.55;
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.auth-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.auth-form input {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
  color: var(--ink);
  outline: 0;
}

.auth-switch {
  margin-top: 18px;
  color: var(--muted);
}

.auth-switch a,
.text-link {
  color: var(--sage-dark);
  font-weight: 800;
}

.form-message {
  min-height: 24px;
  margin: 0;
  color: var(--coral);
  font-weight: 700;
}

.admin-page {
  min-height: 100vh;
  background: var(--canvas);
}

.admin-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 52px;
}

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

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.data-panel {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.86rem;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.service-dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.service-dialog::backdrop {
  background: rgba(20, 28, 24, 0.42);
}

.service-dialog .close-dialog {
  position: absolute;
  top: 14px;
  right: 14px;
}

.service-dialog h2 {
  padding-right: 52px;
}

.service-dialog p {
  color: var(--muted);
  line-height: 1.6;
}

.service-dialog dl {
  display: grid;
  gap: 10px;
  margin: 20px 0;
}

.service-dialog dl div {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 12px;
}

.service-dialog dt {
  color: var(--muted);
  font-weight: 800;
}

.service-dialog dd {
  margin: 0;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .brand span:last-child,
  .nav-item span:last-child,
  .sidebar-footer span:last-child {
    display: none;
  }

  .brand,
  .nav-item,
  .sidebar-footer {
    justify-content: center;
  }

  .nav-item {
    grid-template-columns: 1fr;
  }

  .service-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
  }

  .brand span:last-child,
  .nav-item span:last-child {
    display: block;
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .nav-item {
    grid-template-columns: 1fr;
    justify-items: center;
    min-height: 58px;
    padding: 6px;
    font-size: 0.82rem;
  }

  .sidebar-footer {
    display: none;
  }

  .workspace {
    padding: 22px 14px 42px;
  }

  .topbar,
  .section-heading,
  .admin-header {
    display: grid;
  }

  .topbar-actions,
  .admin-actions {
    justify-content: stretch;
    width: 100%;
  }

  .summary-grid,
  .service-grid,
  .request-layout,
  .admin-tool-grid {
    grid-template-columns: 1fr;
  }

  .crawler-summary {
    grid-template-columns: 1fr;
  }

  .segmented-control {
    overflow-x: auto;
    flex-wrap: nowrap;
    justify-self: start;
    max-width: 100%;
  }

  .segmented-control button {
    flex: 0 0 auto;
  }
}
