/* =========================================================================
   Rooky Portal — main.css
   Executive Minimal Dark · AWS Orange accent · Pretendard
   ========================================================================= */

/* -- Design tokens ------------------------------------------------------- */
:root {
  /* surfaces */
  --bg-primary:   #0F1419;
  --bg-secondary: #1A2332;
  --bg-tertiary:  #11182A;
  --border:       #2A3441;

  /* text */
  --text-primary:   #E5E7EB;
  --text-secondary: #9CA3AF;
  --text-muted:     #6B7280;

  /* accents */
  --accent:        #FF9900;
  --accent-soft:   rgba(255, 153, 0, 0.12);
  --accent-border: rgba(255, 153, 0, 0.30);
  --squid-ink:     #232F3E;

  /* severity */
  --severity-high:   #EF4444;
  --severity-medium: #F59E0B;
  --severity-low:    #10B981;

  /* layout */
  --sidebar-width: 240px;
  --topbar-height: 60px;
  --content-max:   1200px;
  --content-pad:   32px;

  /* type */
  --font-base: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont,
               system-ui, Roboto, 'Helvetica Neue', 'Segoe UI',
               'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, 'SF Mono',
               Menlo, Consolas, monospace;

  /* radius / shadows */
  --radius-sm: 6px;
  --radius:    8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30);
  --shadow:    0 4px 12px rgba(0, 0, 0, 0.40);

  /* timing */
  --t-fast: 120ms ease;
  --t:      200ms ease;
}

/* -- Reset --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-base);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  /* iOS safe area */
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }

/* -- App shell (grid) ---------------------------------------------------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

/* -- Sidebar ------------------------------------------------------------- */
.sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 20;
}

.sidebar-brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.3px;
}
.brand-text { color: var(--text-primary); }
.brand-dot {
  color: var(--accent);
  margin-left: 4px;
  font-size: 10px;
  position: relative;
  top: -2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background var(--t-fast), color var(--t-fast),
              border-color var(--t-fast);
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  text-decoration: none;
}
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-left-color: var(--accent);
}
.nav-icon {
  display: inline-flex;
  width: 22px;
  font-size: 15px;
  justify-content: center;
}
.nav-label { flex: 1; }

.sidebar-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* -- Main column --------------------------------------------------------- */
.main-column {
  display: flex;
  flex-direction: column;
  min-width: 0; /* prevent grid blow-up */
}

.topbar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 var(--content-pad);
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.2px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.hamburger {
  display: none;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 0;
  transition: border-color var(--t-fast);
}
.hamburger:hover { border-color: var(--accent); }
.hamburger span {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 1px;
}

/* -- Content ------------------------------------------------------------- */
.content {
  flex: 1;
  padding: 28px var(--content-pad);
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
  outline: none; /* for tabindex="-1" focus */
}

.loading-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--text-secondary);
  font-size: 14px;
}

/* -- Sidebar overlay (mobile) ------------------------------------------- */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t);
  z-index: 15;
}

/* -- Reusable components ------------------------------------------------- */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }

.card-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.tldr {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 20px;
}
.tldr-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.tldr ul {
  margin: 0;
  padding-left: 20px;
}
.tldr li + li { margin-top: 4px; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.badge--high {
  color: var(--severity-high);
  background: rgba(239, 68, 68, 0.10);
  border-color: rgba(239, 68, 68, 0.30);
}
.badge--medium {
  color: var(--severity-medium);
  background: rgba(245, 158, 11, 0.10);
  border-color: rgba(245, 158, 11, 0.30);
}
.badge--low {
  color: var(--severity-low);
  background: rgba(16, 185, 129, 0.10);
  border-color: rgba(16, 185, 129, 0.30);
}
.badge--accent {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

table.zebra {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.zebra th,
table.zebra td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
table.zebra th {
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
}
table.zebra tr:nth-child(even) td { background: rgba(255, 255, 255, 0.015); }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}
.empty-state .emoji {
  font-size: 36px;
  display: block;
  margin-bottom: 12px;
}

/* -- Coming soon page --------------------------------------------------- */
.coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  color: var(--text-secondary);
}
.coming-soon-icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.coming-soon-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px;
}
.coming-soon-desc {
  max-width: 420px;
  line-height: 1.7;
}

/* -- Responsive ≤768px --------------------------------------------------- */
@media (max-width: 768px) {
  body { font-size: 15px; }

  :root {
    --content-pad: 18px;
    --topbar-height: 56px;
  }

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

  /* Sidebar becomes off-canvas drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    transform: translateX(-100%);
    transition: transform var(--t);
    box-shadow: var(--shadow);
  }
  .app.sidebar-open .sidebar {
    transform: translateX(0);
  }
  .app.sidebar-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .hamburger {
    display: flex;
  }

  .topbar-meta {
    /* hide meta text on small screens to save space */
    display: none;
  }

  .content {
    padding: 20px var(--content-pad);
  }

  /* Cards stack with tighter spacing */
  .card {
    padding: 16px;
  }
}

/* -- Reduce motion ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* =========================================================================
   Brief 전용 스타일 (Phase 3)
   ========================================================================= */

.brief { /* container, just identity */ }
.brief-section { /* alias of card; card + card margin already applied */ }

.muted { color: var(--text-secondary); }
.small { font-size: 12px; }

.empty-state.error {
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.20);
  border-radius: var(--radius);
}
.error-detail {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  margin: 12px auto 0;
  max-width: 480px;
  text-align: left;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---- Actions list ----------------------------------------------------- */
.action-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.action-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.action-row:last-child { border-bottom: none; }
.action-priority {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
}
.action-text { flex: 1; color: var(--text-primary); }
.action-owner {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* ---- Conflicts -------------------------------------------------------- */
.conflict-list { display: flex; flex-direction: column; gap: 14px; }
.conflict {
  padding: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.conflict-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.conflict-when {
  font-family: var(--font-mono);
  color: var(--text-secondary);
}
.conflict-items {
  margin: 8px 0;
  padding-left: 20px;
  color: var(--text-primary);
}
.conflict-items li + li { margin-top: 2px; }
.conflict-suggest {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--accent);
}

/* ---- Calendar table --------------------------------------------------- */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
}
table.zebra.calendar { min-width: 560px; }
.cell-date, .cell-time {
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}
.cal-title { font-weight: 500; color: var(--text-primary); }
.cal-loc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.cell-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.cell-resp { color: var(--text-secondary); white-space: nowrap; font-size: 13px; }

/* ---- Inbox ------------------------------------------------------------ */
.mail {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.mail:last-of-type { border-bottom: none; padding-bottom: 4px; }
.mail-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}
.mail-from {
  font-weight: 600;
  color: var(--text-primary);
}
.mail-attach { opacity: 0.7; }
.mail-time {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}
.mail-subject {
  margin-top: 4px;
  font-weight: 500;
  color: var(--text-primary);
}
.mail-preview {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- Slack ------------------------------------------------------------ */
.slack-list { display: flex; flex-direction: column; gap: 12px; }
.slack {
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.slack-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.slack-channel {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
}
.slack-thread {
  margin-top: 4px;
  color: var(--text-primary);
  font-size: 14px;
}
.slack-summary {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 13px;
}
.slack-action {
  margin-top: 6px;
  font-size: 13px;
  color: var(--accent);
}

/* ---- News ------------------------------------------------------------- */
.news-list { display: flex; flex-direction: column; gap: 16px; }
.news {
  padding: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.news-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
}
.news-date {
  font-family: var(--font-mono);
  color: var(--text-muted);
}
.news-source { color: var(--text-secondary); }
.news-headline {
  margin-top: 6px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
  line-height: 1.4;
}
.news-summary {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
}
.news-aws {
  margin: 10px 0 0;
  padding: 8px 12px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-primary);
}
.aws-label {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent);
  text-transform: uppercase;
  margin-right: 6px;
}
.news-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--accent);
}

/* ---- Responsive tweaks for brief sections (≤768px) -------------------- */
@media (max-width: 768px) {
  .action-row { gap: 8px; padding: 8px 0; }
  .action-priority { min-width: 28px; }
  .conflict, .slack, .news { padding: 10px; }
  .news-headline { font-size: 14px; }
  .mail-time { font-size: 10px; }
  /* calendar table은 .table-scroll 으로 가로 스크롤 */
}
