/* ==========================================================================
   덕성기획 (DEOKSEONG MEDIA) — Admin Console Stylesheet
   ========================================================================== */

:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --navy: #0b203b;
  --navy-soft: #263f63;
  --orange: #e85b0d;
  --orange-hover: #d14f07;
  --orange-soft: #fff4ed;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --green: #059669;
  --green-soft: #ecfdf5;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --text: #132238;
  --muted: #64748b;
  --border: #dfe8f3;
  --radius: 14px;
  --shadow: 0 10px 28px rgba(11, 32, 59, 0.06);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont, 'Malgun Gothic', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }

.is-hidden { display: none !important; }
.req { color: var(--orange); }

.admin-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 700;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.btn--sm { padding: 7px 14px; font-size: 0.82rem; }
.btn--xs { padding: 5px 11px; font-size: 0.78rem; }
.btn--full { width: 100%; }
.btn--primary {
  background: linear-gradient(135deg, #ff6b2b, var(--orange));
  color: #fff;
  box-shadow: 0 6px 18px rgba(232, 91, 13, 0.24);
}
.btn--primary:hover { background: var(--orange-hover); transform: translateY(-1px); }
.btn--primary:disabled { opacity: 0.6; cursor: wait; transform: none; }
.btn--outline {
  background: #fff;
  border-color: var(--border);
  color: var(--navy);
}
.btn--outline:hover { border-color: var(--blue); color: var(--blue); }
.btn--soft {
  background: var(--blue-soft);
  border-color: #dbeafe;
  color: var(--blue);
}
.btn--soft:hover { background: var(--blue); color: #fff; }
.btn--ghost {
  background: transparent;
  color: var(--muted);
}
.btn--ghost:hover { color: var(--navy); background: #eaf0f8; }
.btn--danger {
  background: var(--red-soft);
  border-color: #fecaca;
  color: var(--red);
}
.btn--danger:hover { background: var(--red); color: #fff; }

.text-btn {
  background: none;
  border: none;
  color: var(--red);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0;
}

/* Login Screen */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 80% 10%, rgba(37, 99, 235, 0.1), transparent 45%),
              radial-gradient(circle at 15% 85%, rgba(232, 91, 13, 0.1), transparent 45%),
              #f4f7fb;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 36px 32px;
  box-shadow: 0 20px 50px rgba(11, 32, 59, 0.08);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.login-brand__sym { width: 46px; height: 46px; object-fit: contain; }
.login-brand__word { height: 22px; width: auto; margin-bottom: 3px; }
.login-brand small { font-size: 0.68rem; font-weight: 800; color: var(--orange); letter-spacing: 0.06em; }

.login-card h1 { font-size: 1.45rem; font-weight: 800; color: var(--navy); margin-bottom: 8px; }
.login-desc { font-size: 0.88rem; color: var(--muted); margin-bottom: 22px; }

.login-form { display: flex; flex-direction: column; gap: 10px; }
.login-error { font-size: 0.84rem; font-weight: 700; color: var(--red); min-height: 20px; }
.login-back {
  display: block;
  text-align: center;
  margin-top: 20px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
}
.login-back:hover { color: var(--blue); }

/* Form Inputs */
.field-label {
  display: block;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
}
.field-hint {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 5px;
}
.text-input, .text-area, .select-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-size: 0.92rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.text-input:focus, .text-area:focus, .select-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.text-area { resize: vertical; }

/* Header */
.admin-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.admin-header__inner {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.admin-header__brand { display: flex; align-items: center; gap: 10px; }
.admin-logo-sym { width: 38px; height: 38px; object-fit: contain; }
.admin-logo-txt { display: flex; align-items: center; gap: 8px; }
.admin-logo-word { height: 20px; width: auto; }
.admin-badge {
  background: var(--navy);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.06em;
}
.admin-header__actions { display: flex; align-items: center; gap: 8px; }

/* Main & KPIs */
.admin-main { padding: 28px 20px 64px; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.kpi-card__label { display: block; font-size: 0.8rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.kpi-card__val { font-size: 1.75rem; font-weight: 900; color: var(--navy); }
.kpi-card__val--orange { color: var(--orange); }
.kpi-card__val--blue { color: var(--blue); }
.kpi-card__val--sm { font-size: 1.05rem; font-weight: 800; color: var(--green); }

/* Tabs */
.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 10px;
  flex-wrap: wrap;
}
.admin-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--muted);
}
.admin-tab:hover { color: var(--navy); background: #eaf0f8; }
.admin-tab.is-active {
  background: var(--navy);
  color: #fff;
}
.tab-pill {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.2);
}
.admin-tab:not(.is-active) .tab-pill { background: #e2e8f0; color: var(--navy); }

.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.panel-title { font-size: 1.2rem; font-weight: 800; color: var(--navy); }
.panel-sub { font-size: 0.88rem; color: var(--muted); margin-top: 3px; }

.status-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-filter {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--muted);
}
.chip-filter.is-active { background: var(--blue); border-color: var(--blue); color: #fff; }

/* Quotes List */
.quotes-list { display: flex; flex-direction: column; gap: 16px; }
.quote-item-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
}
.quote-item__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border);
}
.quote-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.q-status {
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}
.q-status--신규 { background: var(--orange-soft); color: var(--orange); }
.q-status--상담중 { background: var(--blue-soft); color: var(--blue); }
.q-status--견적발송 { background: #f3e8ff; color: #7e22ce; }
.q-status--완료 { background: var(--green-soft); color: var(--green); }
.q-type {
  padding: 4px 10px;
  border-radius: 8px;
  background: #f1f5f9;
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 700;
}
.q-date { font-size: 0.8rem; color: var(--muted); }

.quote-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.quote-info-box {
  background: #f8fafd;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
}
.quote-info-box small { display: block; font-size: 0.74rem; color: var(--muted); font-weight: 700; }
.quote-info-box strong { font-size: 0.94rem; color: var(--navy); }
.quote-info-box a { color: var(--blue); text-decoration: underline; }

.quote-items-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.quote-item-tag {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 700;
}

.quote-memo {
  background: #fcfdff;
  border-left: 3px solid var(--blue);
  padding: 10px 14px;
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 14px;
  border-radius: 0 8px 8px 0;
  white-space: pre-wrap;
}

/* Quote Attachment Preview Strip */
.quote-files-section {
  margin-bottom: 16px;
}
.quote-files-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 8px;
}
.quote-files-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.file-thumb-card {
  width: 116px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #f8fafd;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease;
  text-align: left;
  padding: 0;
}
.file-thumb-card:hover {
  transform: translateY(-2px);
  border-color: var(--blue);
}
.file-thumb-card__media {
  height: 82px;
  background: #eef3f9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.file-thumb-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.file-thumb-card__pdf {
  font-size: 0.78rem;
  font-weight: 900;
  color: var(--red);
  background: var(--red-soft);
  padding: 6px 10px;
  border-radius: 8px;
}
.file-thumb-card__name {
  display: block;
  padding: 6px 8px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quote-admin-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.quote-admin-bar .select-input { width: 132px; padding: 8px 10px; }
.quote-admin-bar .text-input { flex: 1; min-width: 180px; padding: 8px 12px; }

/* Portfolio Admin Grid */
.admin-portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.pf-admin-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}
.pf-admin-card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #eef3f9;
  overflow: hidden;
}
.pf-admin-card__media img { width: 100%; height: 100%; object-fit: cover; }
.pf-admin-card__badges {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 6px;
}
.pf-pill {
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--navy);
  font-size: 0.72rem;
  font-weight: 800;
}
.pf-pill--orange { background: var(--orange); color: #fff; }
.pf-admin-card__body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.pf-admin-card__title { font-size: 1rem; font-weight: 800; color: var(--navy); margin-bottom: 6px; }
.pf-admin-card__meta { font-size: 0.8rem; color: var(--muted); margin-bottom: 14px; }
.pf-admin-card__actions {
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Settings Card */
.settings-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 30px;
  max-width: 720px;
  box-shadow: var(--shadow);
}
.settings-form { margin-top: 20px; display: flex; flex-direction: column; gap: 18px; }
.settings-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.modal.is-open { opacity: 1; visibility: visible; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(11, 32, 59, 0.56); backdrop-filter: blur(4px); }
.modal__dialog {
  position: relative;
  z-index: 2;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}
.modal__dialog--lg { max-width: 760px; }
.modal__dialog--preview { max-width: 920px; }

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 5;
}
.modal__head h3 { font-size: 1.12rem; font-weight: 800; color: var(--navy); }
.modal__close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #f8fafd;
  font-size: 1.35rem;
  line-height: 1;
}

.modal__form {
  padding: 22px 24px 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
}

.upload-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.label-between { display: flex; justify-content: space-between; align-items: center; }

.photo-slot {
  position: relative;
  border: 2px dashed #93c5fd;
  border-radius: 12px;
  aspect-ratio: 16 / 10;
  background: #f5f9ff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}
.photo-slot:hover { border-color: var(--blue); background: #ebf3ff; }
.photo-slot__img { width: 100%; height: 100%; object-fit: cover; }
.photo-slot__placeholder { text-align: center; padding: 14px; }
.photo-slot__placeholder strong { display: block; font-size: 0.88rem; color: var(--navy); margin-bottom: 4px; }
.photo-slot__placeholder span { font-size: 0.76rem; color: var(--muted); }

.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-chip { position: relative; cursor: pointer; }
.cat-chip input { position: absolute; opacity: 0; pointer-events: none; }
.cat-chip span {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--muted);
}
.cat-chip input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Preview Modal */
.preview-title-wrap small { display: block; font-size: 0.78rem; color: var(--muted); }
.preview-head-actions { display: flex; align-items: center; gap: 10px; }
.preview-stage {
  padding: 20px;
  background: #0f172a;
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-stage img {
  max-height: 74vh;
  max-width: 100%;
  border-radius: 8px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
}
.preview-stage iframe {
  width: 100%;
  height: 72vh;
  border: none;
  border-radius: 8px;
  background: #fff;
}
.preview-fallback {
  color: #e2e8f0;
  text-align: center;
  padding: 40px 20px;
}

.empty-state {
  background: #fff;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(16px);
  background: var(--navy);
  color: #fff;
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  opacity: 0;
  visibility: hidden;
  z-index: 2000;
  transition: all 0.24s ease;
}
.toast.is-visible { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-portfolio-grid { grid-template-columns: repeat(2, 1fr); }
  .quote-info-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .admin-portfolio-grid,
  .upload-pair,
  .form-grid-2 { grid-template-columns: 1fr; }
  .quote-item-card { padding: 16px; }
}
