:root {
  --bg: #f3f7ff;
  --surface: #ffffff;
  --line: #d8e3f8;
  --text: #0f172a;
  --muted: #5c6e8f;
  --primary: #0d3f91;
  --primary-2: #1a64cd;
  --danger: #be123c;
  --shadow: 0 20px 48px rgba(14, 53, 122, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans KR", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #f9fbff 0%, var(--bg) 100%);
}

.bg-shape {
  position: fixed;
  pointer-events: none;
  z-index: -1;
  border-radius: 50%;
  filter: blur(8px);
}

.bg-shape-a {
  width: 340px;
  height: 340px;
  top: -130px;
  right: -80px;
  background: radial-gradient(circle, rgba(26, 100, 205, 0.26), transparent 68%);
}

.bg-shape-b {
  width: 260px;
  height: 260px;
  left: -90px;
  bottom: -80px;
  background: radial-gradient(circle, rgba(13, 63, 145, 0.22), transparent 70%);
}

.topbar {
  width: min(1200px, calc(100% - 2rem));
  margin: 1rem auto 0;
  padding: 0.95rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.brand-wrap {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
}

.brand {
  color: var(--primary);
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  text-decoration: none;
}

.brand-sub {
  color: var(--muted);
  font-size: 0.92rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.mode-pill {
  border: 1px solid #bcd0f2;
  border-radius: 999px;
  padding: 0.36rem 0.72rem;
  font-size: 0.8rem;
  color: var(--primary);
  background: #f1f6ff;
}

.layout {
  width: min(1200px, calc(100% - 2rem));
  margin: 1rem auto 2rem;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1rem;
}

.admin-auth-screen {
  width: min(520px, calc(100% - 2rem));
  margin: 1.1rem auto 2rem;
  padding: 1.2rem;
}

.admin-auth-form {
  margin-top: 1rem;
  display: grid;
  gap: 0.55rem;
}

.admin-auth-form label {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.88rem;
}

.form-message {
  min-height: 1.15rem;
  margin: 0.1rem 0 0.2rem;
  font-size: 0.85rem;
}

.form-message.error {
  color: var(--danger);
}

.form-message.success {
  color: #0a7f3f;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.sidebar {
  padding: 0.8rem;
  height: fit-content;
  position: sticky;
  top: 1rem;
}

.side-btn {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  border-radius: 12px;
  padding: 0.72rem 0.75rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  margin-bottom: 0.4rem;
}

.side-btn:hover {
  background: #eff5ff;
}

.side-btn.active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.content {
  display: grid;
  gap: 1rem;
}

.panel {
  padding: 1.1rem;
}

.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(12, 24, 46, 0.48);
  padding: 1rem;
}

.modal.open {
  display: flex;
}

.modal-card {
  width: min(580px, 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.member-edit-form {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.55rem;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.field-grid label {
  display: grid;
  gap: 0.28rem;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.field-grid .field-full {
  grid-column: 1 / -1;
}

.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

h2 {
  margin: 0;
  font-family: "Montserrat", "Noto Sans KR", sans-serif;
  font-size: 1.25rem;
}

.sub {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.stats-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

.stat-box {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f9fbff;
  padding: 0.95rem;
}

.stat-box strong {
  display: block;
  font-family: "Montserrat", sans-serif;
  font-size: 1.6rem;
  color: var(--primary);
}

.stat-box span {
  color: var(--muted);
  font-size: 0.88rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.pagination {
  margin-top: 0.72rem;
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
}

.pager-btn {
  border: 1px solid #c7d7f5;
  background: #f6f9ff;
  color: var(--primary);
  border-radius: 8px;
  padding: 0.35rem 0.62rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.pager-btn.active {
  background: linear-gradient(130deg, var(--primary), var(--primary-2));
  color: #fff;
  border-color: transparent;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  text-align: left;
  padding: 0.72rem 0.7rem;
  border-bottom: 1px solid #e4ecfa;
  white-space: nowrap;
}

th {
  color: var(--primary);
  background: #f4f8ff;
  font-size: 0.82rem;
}

.members-table {
  table-layout: fixed;
  min-width: 1120px;
}

.members-table .col-created {
  width: 14%;
}

.members-table .col-member-name {
  width: 11%;
}

.members-table .col-member-login {
  width: 10%;
}

.members-table .col-member-email {
  width: 18%;
}

.members-table .col-member-company {
  width: 14%;
}

.members-table .col-member-point {
  width: 11%;
}

.members-table .col-member-role {
  width: 8%;
}

.members-table .col-member-action {
  width: 14%;
}

.orders-table {
  table-layout: fixed;
  min-width: 1200px;
}

.orders-table th,
.orders-table td {
  overflow: hidden;
}

.orders-table td {
  white-space: normal;
  vertical-align: top;
}

.orders-table .col-date {
  width: 12%;
}

.orders-table .col-title {
  width: 17%;
}

.orders-table .col-login-id {
  width: 9%;
}

.orders-table .col-email {
  width: 15%;
}

.orders-table .col-media {
  width: 13%;
}

.orders-table .col-budget {
  width: 9%;
}

.orders-table .col-attachment {
  width: 17%;
  vertical-align: top;
}

.orders-table .col-status {
  width: 8%;
}

.orders-table .col-status select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 0.48rem 0.44rem;
  font-size: 0.8rem;
}

.cell-ellipsis {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  border: 1px solid #cfdbf2;
  border-radius: 10px;
  padding: 0.66rem 0.7rem;
  background: #fff;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary-2);
  box-shadow: 0 0 0 3px rgba(26, 100, 205, 0.12);
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.62rem 0.8rem;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn.small {
  padding: 0.34rem 0.58rem;
  border-radius: 8px;
  font-size: 0.78rem;
}

.attach-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.3rem;
  min-width: 0;
}

.orders-table .attach-actions .btn.small {
  width: 100%;
  min-width: 0;
  padding: 0.32rem 0.34rem;
  font-size: 0.74rem;
  line-height: 1.2;
}

.attach-meta {
  color: var(--muted);
  font-size: 0.78rem;
  max-width: 100%;
  line-height: 1.3;
  grid-column: 1 / -1;
}

.file-ellipsis {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attach-empty {
  color: var(--muted);
  font-size: 0.82rem;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(130deg, var(--primary), var(--primary-2));
}

.btn-light {
  color: var(--primary);
  background: #fff;
  border-color: #c8d8f6;
}

.btn-danger {
  color: var(--danger);
  background: #fff;
  border-color: #f3bccb;
}

.log-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: grid;
  gap: 0.5rem;
}

.log-list li {
  border: 1px solid var(--line);
  background: #f9fbff;
  border-radius: 10px;
  padding: 0.72rem;
  font-size: 0.9rem;
}

.log-time {
  color: var(--muted);
  font-size: 0.8rem;
}

@media (max-width: 1040px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.4rem;
  }

  .side-btn {
    margin-bottom: 0;
    text-align: center;
    padding: 0.55rem;
    font-size: 0.86rem;
  }

  .form-grid {
    grid-template-columns: 1fr 1fr;
  }

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

@media (max-width: 680px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .sidebar {
    grid-template-columns: 1fr 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .attach-actions {
    grid-template-columns: 1fr;
  }
}
