:root {
  --navy: #0a1330;
  --navy-deep: #060b1c;
  --navy-light: #16213f;
  --gold: #c9a24b;
  --gold-bright: #e0bc6b;
  --bg: #070c1a;
  --card-bg: #101a30;
  --text: #e7ecf5;
  --muted: #8a95ab;
  --border: #223154;
  --green: #2f7a4a;
  --green-bg: #17301f;
  --red-bg: #3a1f1f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 0;
}

/* ---------- Topbar / brand ---------- */
.topbar {
  background: linear-gradient(180deg, var(--navy-deep), var(--navy));
  border-bottom: 3px solid var(--gold);
  box-shadow: 0 2px 0 var(--navy-deep), 0 3px 0 var(--gold-bright);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}
.brand-seal { height: 44px; width: 44px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-title {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 1.2px;
  color: var(--gold-bright);
}
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: .4px; }

.user-box { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.user-name { color: var(--text); font-weight: 600; }

.container { max-width: 1100px; margin: 0 auto; padding: 30px 20px; }

/* ---------- Grid / cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 22px;
}
.card h2 {
  margin: 0 0 14px;
  font-size: 15px;
  color: var(--gold);
  letter-spacing: .3px;
  text-transform: uppercase;
}
.card-wide { grid-column: 1 / -1; }

.label { color: var(--muted); margin-right: 8px; font-size: 13px; }
.muted { color: var(--muted); font-size: 14px; }
.tier { color: var(--muted); font-size: 13px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--border); }
th {
  color: var(--gold);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .3px;
  background: var(--navy-light);
}
tbody tr:nth-child(even) { background: rgba(255,255,255,0.02); }

.schedule-list { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.schedule-list li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.schedule-list li:last-child { border-bottom: none; }

.tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  margin-right: 6px;
}
.tag-개인 { background: #2a3a63; color: #a9c1ff; }
.tag-공유 { background: #3a2a1f; color: var(--gold); }

.badge { display: inline-block; padding: 4px 10px; border-radius: 6px; font-size: 13px; margin-bottom: 10px; font-weight: 600; }
.badge-warn { background: #4a2a1f; color: #ffb37a; }
.badge-ok { background: var(--green-bg); color: #8fdba0; }

.score { font-size: 32px; font-weight: 700; color: var(--gold); margin: 0; }

/* ---------- Login ---------- */
.login-card {
  max-width: 400px;
  margin: 60px auto 0;
  text-align: center;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px 30px;
}
.login-seal { height: 110px; width: 110px; object-fit: contain; margin-bottom: 8px; }
.login-tagline {
  font-style: italic;
  color: var(--gold-bright);
  font-weight: 700;
  letter-spacing: .5px;
  margin: 0 0 6px;
}
.login-card h1 { margin: 0 0 8px; font-size: 22px; }

.btn-discord {
  display: inline-block;
  margin-top: 20px;
  background: #5865F2;
  color: white;
  text-decoration: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
}
.btn-discord:hover { background: #4752c4; }

.btn-ghost {
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 13px;
}
.btn-ghost:hover { color: var(--text); border-color: var(--gold); }

.error { color: #ff8080; font-size: 14px; }

.flash {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 18px;
}
.flash-ok { background: #1f3a2a; color: #8fdba0; border: 1px solid #2c5a3d; }
.flash-error { background: #3a1f1f; color: #ff8f8f; border: 1px solid #5a2c2c; }

.request-form {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.request-form summary {
  cursor: pointer;
  color: var(--gold);
  font-size: 13px;
}
.request-form form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.request-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.request-form input, .request-form select {
  background: var(--navy-light);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 14px;
}

.btn-primary {
  background: var(--gold);
  color: #1a1400;
  border: none;
  padding: 9px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.btn-primary:hover { background: var(--gold-bright); }
.btn-primary:disabled { background: var(--navy-light); color: var(--muted); cursor: not-allowed; }

.btn-small {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.btn-small:hover { color: #ff8f8f; border-color: #5a2c2c; }

/* ---------- Attendance ---------- */
.attendance-actions { display: flex; gap: 10px; margin-top: 10px; }
.attendance-actions button:disabled {
  background: var(--navy-light);
  color: var(--muted);
  cursor: not-allowed;
}

.sub-h {
  margin: 22px 0 10px;
  font-size: 13px;
  color: var(--gold);
  font-weight: 600;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}
.stat-box {
  background: var(--navy-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { font-size: 18px; font-weight: 700; color: var(--text); margin: 4px 0 2px; }
.stat-sub { font-size: 12px; color: var(--muted); }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 12px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.cal-none { background: var(--navy-light); }
.cal-working { background: #4a2a1f; color: #ffb37a; border-color: #5a2c2c; }
.cal-done { background: var(--green-bg); color: #8fdba0; border-color: #2c5a3d; }

.cal-legend { font-size: 12px; color: var(--muted); margin-top: 10px; }
.cal-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 4px 0 10px; vertical-align: middle; }
.cal-legend .cal-dot.cal-done { background: var(--green-bg); border: 1px solid #2c5a3d; }
.cal-legend .cal-dot.cal-working { background: #4a2a1f; border: 1px solid #5a2c2c; }
.cal-legend .cal-dot.cal-none { background: var(--navy-light); border: 1px solid var(--border); }

.live-board { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.live-board li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.live-board li:last-child { border-bottom: none; }

/* ---------- Org chart ---------- */
.org-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.org-title { margin: 0; font-size: 20px; color: var(--gold-bright); }

.org-tree { list-style: none; padding-left: 0; margin: 0; }
.org-tree .org-tree { padding-left: 26px; margin-top: 8px; border-left: 1px solid var(--border); }
.org-unit { margin-bottom: 14px; }
.org-unit-name {
  font-weight: 700;
  color: var(--gold);
  font-size: 15px;
  padding: 4px 0;
}
.org-members { list-style: none; padding: 0; margin: 4px 0 0 4px; }
.org-member {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 14px;
  padding: 3px 0;
}
.org-rank {
  color: var(--muted);
  font-size: 12px;
  min-width: 60px;
}
.org-member-name { color: var(--text); }

.org-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-top: 10px;
}
.org-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.org-form input, .org-form select {
  background: var(--navy-light);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 14px;
}

.org-admin-unit {
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}
.org-admin-unit summary { cursor: pointer; color: var(--text); }

.org-member-rows { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.org-member-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.org-member-row input[type="text"] {
  background: var(--navy-light);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
  flex: 1;
  min-width: 100px;
}
.org-order-input { width: 60px; }

/* ---------- Mobile bottom tab bar (mobile-only nav) ---------- */
.mobile-tabbar {
  display: none;
}

/* ================= Responsive breakpoints ================= */

/* Desktop: wider container, hover states are fine as-is (default styles above are desktop-first) */
@media (min-width: 900px) {
  .container { padding: 34px 24px 50px; }
}

/* Tablet / mobile */
@media (max-width: 899px) {
  .grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr; }

  .topbar-inner { padding: 8px 14px; }
  .brand-seal { height: 34px; width: 34px; }
  .brand-title { font-size: 12px; }
  .brand-sub { font-size: 10px; }

  /* On mobile, the bottom tab bar handles navigation, so trim the top nav to just the name */
  .user-box .btn-ghost { display: none; }

  .container { padding: 18px 14px 90px; }

  table { font-size: 12px; }
  th, td { padding: 6px 4px; }

  .mobile-tabbar {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--navy-deep);
    border-top: 2px solid var(--gold);
    z-index: 30;
  }
  .mobile-tabbar a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px 10px;
    color: var(--muted);
    text-decoration: none;
    font-size: 10px;
  }
  .mobile-tabbar a span { line-height: 1; }
}

@media (max-width: 420px) {
  .calendar-grid { gap: 4px; }
  .cal-day { font-size: 10px; }
}

/* ================= MDT / iPad 느낌 확장 스타일 ================= */

.tiny { font-size: 11px !important; }

/* 상태 점 (온라인 표시 느낌) */
.mdt-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px #4ade80;
  margin-right: 7px;
  vertical-align: middle;
}

/* 카드에 살짝 유리질감 + 탭 느낌의 상단 라인 */
.card {
  position: relative;
  box-shadow: 0 1px 0 rgba(255,255,255,0.02) inset, 0 6px 16px rgba(0,0,0,0.25);
}
.card::before {
  content: "";
  position: absolute;
  top: 0; left: 14px; right: 14px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: .5;
}

/* ---------- 공지사항 ---------- */
.notice-board { margin-bottom: 18px; }
.notice-board-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.btn-small-accent { color: var(--gold); border-color: var(--gold); }
.notice-list { display: flex; flex-direction: column; gap: 10px; }
.notice-item {
  background: var(--navy-light);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}
.notice-item.notice-pinned { border-left-color: var(--gold); background: #17203a; }
.notice-item-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.notice-title { font-weight: 700; font-size: 14px; color: var(--text); }
.pin-dot {
  color: var(--gold);
  font-size: 10px;
  font-weight: 800;
  border: 1px solid var(--gold);
  border-radius: 4px;
  padding: 1px 4px;
  margin-right: 6px;
  vertical-align: middle;
}
.notice-meta { font-size: 11px; color: var(--muted); white-space: nowrap; }
.notice-content { font-size: 13px; color: var(--text); margin: 8px 0 6px; white-space: pre-wrap; line-height: 1.5; }
.notice-new summary { list-style: none; }
.notice-new summary::-webkit-details-marker { display: none; }
.request-form-inline { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.request-form-inline label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.request-form-inline input, .request-form-inline textarea {
  background: var(--navy-light);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}
.checkbox-inline { flex-direction: row !important; align-items: center; gap: 6px !important; }

/* ---------- 프로필 카드 ---------- */
.profile-row { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.profile-rank-badge {
  background: linear-gradient(160deg, var(--gold), var(--gold-bright));
  color: #1a1400;
  font-weight: 800;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 8px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(201,162,75,0.35);
}
.profile-name { font-size: 17px; font-weight: 700; color: var(--text); }

/* ---------- 예상 주급 카드 ---------- */
.pay-card .pay-amount {
  font-size: 30px;
  font-weight: 800;
  color: var(--gold-bright);
  margin: 4px 0 6px;
}

/* ---------- 조직도 프로필 카드 그리드 ---------- */
.org-tree { display: flex; flex-direction: column; gap: 18px; }
.org-children { margin-top: 10px; padding-left: 20px; border-left: 1px solid var(--border); }
.org-profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.profile-tile {
  background: var(--navy-light);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}
.profile-tile-rank {
  font-size: 11px;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: .3px;
  margin-bottom: 4px;
}
.profile-tile-name { font-size: 14px; font-weight: 700; color: var(--text); }
.profile-tile-badge {
  margin-top: 6px;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: .5px;
  font-family: "Courier New", monospace;
}
.org-badge-input { width: 90px; }

/* ---------- 할 일 ---------- */
.todo-cal-filter { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.todo-cal-filter input[type="date"] {
  background: var(--navy-light);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 8px;
  border-radius: 6px;
  margin-left: 6px;
}
.todo-cal-result { font-size: 13px; }
.todo-cal-row { padding: 3px 0; }
.todo-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.todo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.todo-item {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--navy-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}
.todo-item.todo-done { opacity: .55; }
.todo-item.todo-done .todo-text { text-decoration: line-through; }
.todo-toggle-form, .todo-del-form { margin: 0; }
.todo-check {
  background: none;
  border: 1px solid var(--border);
  color: var(--gold-bright);
  border-radius: 50%;
  width: 24px; height: 24px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}
.todo-text { flex: 1; min-width: 100px; color: var(--text); }
.todo-due { font-size: 11px; color: var(--muted); background: var(--navy); padding: 2px 6px; border-radius: 4px; }

/* ---------- 시급표 관리 ---------- */
.pay-rate-form input[type="number"] {
  background: var(--navy-light);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 8px;
  border-radius: 6px;
  width: 100px;
}

@media (max-width: 899px) {
  .todo-columns { grid-template-columns: 1fr; }
  .notice-board-head { flex-direction: column; }
}
