/* IDC Rack Manager v6 visual system — loaded after legacy styles. */
:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #172033;
  --muted: #697386;
  --line: #e4e7ec;
  --dark: #111827;
  --accent: #3563e9;
  --accent-dark: #2449ba;
  --danger: #c93c45;
  --success: #14866d;
  --sidebar-width: 268px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 10px 30px rgba(16, 24, 40, .07);
}

html { scroll-behavior: smooth; }

body {
  background:
    radial-gradient(circle at 85% 5%, rgba(53, 99, 233, .07), transparent 26rem),
    var(--bg);
  font-family: Inter, Pretendard, "Noto Sans KR", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}

button, input, select { font: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(53, 99, 233, .24);
  outline-offset: 2px;
}

#appScreen { min-height: 100vh; }

.topbar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  height: 100vh;
  padding: 28px 20px 22px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 30px;
  background: #111827;
  border-right: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 12px 0 36px rgba(15, 23, 42, .09);
  overflow-y: auto;
}

.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, #4f7cff, #3151c7);
  box-shadow: 0 8px 20px rgba(53, 99, 233, .35);
  font-weight: 850;
  letter-spacing: -.04em;
}
.brand-kicker {
  display: block;
  color: #7f8aa3;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.brand h1 { margin: 1px 0 0; font-size: 17px; letter-spacing: -.025em; }
.brand p { margin-top: 3px; color: #8f9ab0; font-size: 10px; }

.main-menu { display: grid; gap: 7px; }
.menu-btn {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #aeb7c8;
  font-size: 13px;
  font-weight: 650;
  text-align: left;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}
.menu-btn:hover { background: rgba(255,255,255,.055); color: #fff; transform: translateX(2px); }
.menu-btn.active {
  background: rgba(79, 124, 255, .16);
  border-color: rgba(112, 148, 255, .16);
  color: #fff;
  box-shadow: inset 3px 0 #7192ff;
}
.menu-icon { width: 20px; text-align: center; color: #8da6ff; font-size: 17px; }

.top-actions {
  margin-top: auto;
  display: grid;
  gap: 8px;
  align-items: stretch;
}
.top-actions .btn { width: 100%; justify-content: flex-start; }
.top-actions .btn-success { order: -1; }
.user-badge {
  margin-bottom: 4px;
  padding: 10px 11px;
  overflow: hidden;
  color: #cbd3df;
  background: rgba(255,255,255,.035);
  border-color: rgba(255,255,255,.08);
  border-radius: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.account-actions .btn { padding-inline: 8px; font-size: 11px; }

.layout {
  width: auto;
  max-width: 1800px;
  margin-left: var(--sidebar-width);
  padding: 44px clamp(24px, 4vw, 68px) 70px;
}

.page-heading, .section-heading, .command-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}
.page-heading { margin-bottom: 24px; }
.page-heading h2 { margin: 5px 0 5px; font-size: clamp(27px, 3vw, 38px); letter-spacing: -.045em; line-height: 1.15; }
.page-heading p, .section-heading p, .command-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.eyebrow, .section-kicker {
  color: var(--accent);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .14em;
}
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid #dce2ea;
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  color: #5e6878;
  font-size: 11px;
  font-weight: 700;
}
.live-indicator i { width: 7px; height: 7px; border-radius: 50%; background: #22a77a; box-shadow: 0 0 0 4px rgba(34,167,122,.12); }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}
.summary-card {
  min-height: 108px;
  padding: 19px 20px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255,255,255,.92);
  box-shadow: var(--shadow-sm);
}
.summary-card span { color: #7b8494; font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.summary-card strong { margin-top: 12px; color: #172033; font-size: 27px; letter-spacing: -.035em; }

.panel {
  border-color: var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}
.command-center { padding: 20px; margin-bottom: 14px; }
.command-heading { align-items: center; padding-bottom: 16px; border-bottom: 1px solid #edf0f3; }
.command-heading h2, .section-heading h2, .operation-card h2 { margin: 2px 0 0; font-size: 17px; letter-spacing: -.025em; }
.search-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding-top: 17px; }
.search-unit label { display: block; margin-bottom: 7px; color: #4f596a; font-size: 11px; font-weight: 750; }
.search-box { min-width: 0; gap: 6px; }
.search-box input { min-width: 0; flex: 1; }

input, select {
  min-height: 40px;
  border-color: #dce1e8;
  border-radius: 9px;
  background: #fff;
  color: var(--text);
}
input::placeholder { color: #a4acb8; }
input:focus, select:focus { border-color: #7192ed; box-shadow: 0 0 0 3px rgba(53,99,233,.1); }
.btn {
  min-height: 39px;
  border-radius: 9px;
  background: var(--accent);
  box-shadow: none;
  font-size: 12px;
  font-weight: 750;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-ghost { background: #f5f7f9; color: #445064; border: 1px solid #e2e6eb; }
.btn-danger { background: rgba(201,60,69,.1); color: #fda4aa; border: 1px solid rgba(248,113,113,.14); }
.layout .btn-danger { color: #b92e38; }
.btn-success { background: #1d8e74; }

.operations-drawer {
  margin: 0 0 28px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255,255,255,.65);
  overflow: hidden;
}
.operations-drawer summary {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 18px;
  cursor: pointer;
  list-style: none;
}
.operations-drawer summary::-webkit-details-marker { display: none; }
.operations-drawer summary > span:first-child { display: flex; flex-direction: column; }
.operations-drawer summary b { font-size: 13px; }
.operations-drawer summary small, .drawer-hint { color: var(--muted); font-size: 11px; }
.drawer-hint::after { content: "＋"; margin-left: 9px; color: var(--accent); font-size: 16px; }
.operations-drawer[open] .drawer-hint::after { content: "−"; }
.operations-grid { display: grid; grid-template-columns: .9fr 1.1fr; border-top: 1px solid var(--line); }
.operation-card { min-width: 0; padding: 20px; }
.operation-card.add-rack, .operation-card.csv-panel { display: block; }
.operation-card + .operation-card { border-left: 1px solid var(--line); }
.operation-card p { margin: 5px 0 15px; color: var(--muted); font-size: 12px; }
.operation-controls { display: grid; grid-template-columns: 1fr auto; gap: 7px; align-items: end; }
.operation-controls label { grid-column: 1 / -1; font-size: 11px; font-weight: 700; }
.csv-actions { gap: 6px; }

.rack-section { margin-top: 26px; }
.section-heading { align-items: center; margin-bottom: 13px; }
.rack-wrap { gap: 14px; padding: 2px 2px 18px; }
.rack-card {
  border: 1px solid #dfe4ea;
  border-radius: 13px;
  box-shadow: 0 4px 16px rgba(16,24,40,.05);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.rack-card:hover { transform: translateY(-2px); border-color: #c9d2df; box-shadow: var(--shadow-md); }
.rack-head { background: #fafbfc; border-bottom: 1px solid #e8ebef; border-radius: 12px 12px 0 0; }
.rack-visual { background: #f8fafc; }

.auth-screen { background: #111827; }
.auth-screen::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(76,111,220,.25), transparent 30rem);
  pointer-events: none;
}
.auth-card { position: relative; border: 1px solid rgba(255,255,255,.1); border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.32); }

@media (max-width: 1180px) {
  :root { --sidebar-width: 224px; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-columns { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .topbar {
    position: sticky;
    width: 100%;
    height: auto;
    padding: 12px 14px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    overflow: visible;
  }
  .brand-mark { width: 36px; height: 36px; }
  .brand-kicker, .brand p { display: none; }
  .main-menu { grid-column: 1 / -1; display: flex; gap: 5px; overflow-x: auto; }
  .menu-btn { width: auto; min-width: max-content; min-height: 37px; padding: 8px 11px; }
  .menu-btn.active { box-shadow: inset 0 -2px #7192ff; }
  .menu-icon { display: none; }
  .top-actions { margin: 0; display: block; }
  .top-actions > :not(.user-badge) { display: none; }
  .user-badge { max-width: 150px; margin: 0; }
  .layout { margin-left: 0; padding: 24px 14px 50px; }
  .operations-grid { grid-template-columns: 1fr; }
  .operation-card + .operation-card { border-left: 0; border-top: 1px solid var(--line); }
}

@media (max-width: 600px) {
  .page-heading { align-items: flex-start; }
  .page-heading p { max-width: 25rem; }
  .live-indicator { display: none; }
  .summary-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .summary-card { min-height: 92px; padding: 15px; }
  .summary-card strong { font-size: 22px; }
  .command-center { padding: 16px; }
  .command-heading { display: block; }
  .command-heading > p { margin-top: 6px; }
  .search-box { display: grid; grid-template-columns: 1fr auto; }
  .search-box input { grid-column: 1 / -1; width: 100%; }
  .operations-drawer summary { padding-inline: 14px; }
  .drawer-hint { font-size: 0; }
  .operation-card { padding: 16px; }
  .operation-controls { grid-template-columns: 1fr; }
  .operation-controls label { grid-column: auto; }
  .section-heading { display: block; }
  .section-heading > p { margin-top: 4px; }
}
