/* ============================================================
   TeamFlow — Page-specific styles
   ============================================================ */

/* ================= Auth (Login / Register / Forgot) ================= */
.auth-page {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--s-lg);
  background:
    radial-gradient(600px 320px at 50% -10%, rgba(255, 90, 31, 0.10), transparent 70%),
    var(--canvas);
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: var(--s-xl); }
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  box-shadow: inset 0 1px 0 var(--edge-highlight);
  padding: var(--s-xl);
  animation: rise-in var(--t-slow) var(--ease) both;
}
.auth-title { font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: -0.4px; text-align: center; }
.auth-sub { font-size: 14px; color: var(--ink-subtle); text-align: center; margin-top: 6px; margin-bottom: var(--s-lg); }
.auth-form { display: flex; flex-direction: column; gap: var(--s-md); }
.auth-alt { display: flex; flex-direction: column; gap: var(--s-xs); margin-bottom: var(--s-lg); }
.auth-sep { display: flex; align-items: center; gap: var(--s-sm); color: var(--ink-tertiary); font-size: 12px; margin-bottom: var(--s-lg); }
.auth-sep::before, .auth-sep::after { content: ""; flex: 1; height: 1px; background: var(--hairline); }
.auth-foot { text-align: center; font-size: 14px; color: var(--ink-subtle); margin-top: var(--s-lg); }
.auth-foot a, .link { color: var(--primary-hover); font-weight: 500; }
.auth-foot a:hover, .link:hover { text-decoration: underline; }
.auth-meta { margin-top: var(--s-xl); font-size: 12px; color: var(--ink-tertiary); }

/* ================= Dashboard ================= */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-md); margin-bottom: var(--s-lg); }
.stat-card .stat-label { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--ink-subtle); }
.stat-card .stat-label i { color: var(--ink-tertiary); font-size: 13px; }
.stat-value { font-family: var(--font-display); font-size: 32px; font-weight: 600; letter-spacing: -1px; line-height: 1.15; margin-top: 6px; }
.stat-delta { font-size: 12px; margin-top: 4px; display: inline-flex; align-items: center; gap: 4px; }

.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: var(--s-md); align-items: start; }
.dash-col { display: flex; flex-direction: column; gap: var(--s-md); }

.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s-md); }
.card-head h3 { font-family: var(--font-display); font-size: 16px; font-weight: 600; letter-spacing: -0.2px; }
.card-head .link { font-size: 13px; }

/* Activity timeline */
.timeline { display: flex; flex-direction: column; }
.timeline-item { display: flex; gap: var(--s-sm); padding: 10px 0; position: relative; }
.timeline-item:not(:last-child)::before {
  content: ""; position: absolute; left: 15px; top: 44px; bottom: -6px;
  width: 1px; background: var(--hairline);
}
.timeline-body { flex: 1; min-width: 0; font-size: 14px; color: var(--ink-muted); }
.timeline-body b { color: var(--ink); font-weight: 600; }
.timeline-time { font-size: 12px; color: var(--ink-tertiary); margin-top: 2px; }

/* Task rows */
.task-row {
  display: flex; align-items: center; gap: var(--s-sm);
  padding: 9px 10px; margin: 0 -10px; border-radius: var(--r-sm);
  transition: background-color var(--t-fast) var(--ease);
  cursor: pointer;
}
.task-row:hover { background: var(--surface-2); }
.task-check {
  width: 16px; height: 16px; flex-shrink: 0;
  border: 1.5px solid var(--hairline-tertiary); border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: transparent; font-size: 9px;
  transition: all var(--t-fast) var(--ease);
}
.task-row.done .task-check { background: var(--primary); border-color: var(--primary); color: #fff; }
.task-row.done .task-title { text-decoration: line-through; color: var(--ink-tertiary); }
.task-title { font-size: 14px; color: var(--ink); }
.task-meta { display: flex; align-items: center; gap: var(--s-xs); margin-left: auto; flex-shrink: 0; }
.task-id { font-family: var(--font-mono); font-size: 11px; color: var(--ink-tertiary); }
.prio { width: 14px; text-align: center; font-size: 11px; }
.prio-urgent { color: var(--tag-red); } .prio-high { color: var(--tag-orange); }
.prio-medium { color: var(--tag-yellow); } .prio-low { color: var(--ink-tertiary); }

/* Meetings */
.meeting-row { display: flex; gap: var(--s-sm); padding: 10px 0; border-bottom: 1px solid var(--hairline); }
.meeting-row:last-child { border-bottom: none; }
.meeting-time { font-family: var(--font-mono); font-size: 12px; color: var(--ink-subtle); min-width: 64px; padding-top: 2px; }
.meeting-title { font-size: 14px; font-weight: 500; color: var(--ink); }
.meeting-sub { font-size: 12px; color: var(--ink-subtle); margin-top: 2px; }

/* ================= Channels ================= */
.channel-toolbar { display: flex; align-items: center; gap: var(--s-sm); margin-bottom: var(--s-md); flex-wrap: wrap; }
.channel-toolbar .input-icon-wrap { flex: 1; min-width: 220px; }
.channel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-md); }
.channel-card { display: flex; flex-direction: column; gap: var(--s-sm); cursor: pointer; }
.channel-card-head { display: flex; align-items: center; gap: 10px; }
.channel-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--r-md);
  background: var(--surface-3); border: 1px solid var(--hairline-strong);
  color: var(--ink-subtle); font-size: 14px; font-weight: 600;
}
.channel-name { font-size: 15px; font-weight: 600; letter-spacing: -0.2px; }
.channel-desc { font-size: 13px; color: var(--ink-subtle); line-height: 1.5; flex: 1; }
.channel-foot { display: flex; align-items: center; justify-content: space-between; }
.channel-members { display: flex; align-items: center; gap: var(--s-xs); font-size: 12px; color: var(--ink-tertiary); }

/* ================= Chat ================= */
.chat-page { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.chat-header {
  display: flex; align-items: center; gap: var(--s-sm);
  padding: 0 var(--s-md); min-height: 49px;
  border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
}
.chat-header .title { font-size: 15px; font-weight: 600; letter-spacing: -0.2px; display: flex; align-items: center; gap: 6px; }
.chat-header .topic { font-size: 13px; color: var(--ink-subtle); border-left: 1px solid var(--hairline); padding-left: var(--s-sm); }

.chat-scroll { flex: 1; overflow-y: auto; padding: var(--s-md) var(--s-lg); }

.day-divider { display: flex; align-items: center; gap: var(--s-sm); margin: var(--s-md) 0; }
.day-divider::before, .day-divider::after { content: ""; flex: 1; height: 1px; background: var(--hairline); }
.day-divider span {
  font-size: 12px; font-weight: 500; color: var(--ink-subtle);
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-radius: var(--r-pill); padding: 3px 12px;
}

.msg { display: flex; gap: var(--s-sm); padding: 6px var(--s-sm); margin: 0 calc(-1 * var(--s-sm)); border-radius: var(--r-md); position: relative; }
.msg:hover { background: var(--surface-1); }
.msg.compact { padding-top: 2px; padding-bottom: 2px; }
.msg.compact .avatar { visibility: hidden; height: 0; }
.msg-head { display: flex; align-items: baseline; gap: 8px; }
.msg-author { font-size: 14px; font-weight: 600; color: var(--ink); }
.msg-time { font-size: 11px; color: var(--ink-tertiary); }
.msg-text { font-size: 14px; color: var(--ink-muted); line-height: 1.55; overflow-wrap: break-word; }
.msg-text a { color: var(--primary-hover); }
.msg-text code { font-family: var(--font-mono); font-size: 12px; background: var(--surface-3); border: 1px solid var(--hairline); border-radius: var(--r-xs); padding: 1px 5px; }
.msg.pinned-mark::after {
  content: "\f08d"; font-family: "Font Awesome 6 Free"; font-weight: 900;
  position: absolute; top: 8px; right: 10px; font-size: 10px; color: var(--ink-tertiary);
}

.msg-actions {
  position: absolute; top: -14px; right: var(--s-sm);
  display: none; gap: 2px; padding: 2px;
  background: var(--surface-3); border: 1px solid var(--hairline-strong);
  border-radius: var(--r-md);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.msg:hover .msg-actions { display: flex; }
.msg-actions .btn-icon { width: 26px; height: 26px; font-size: 12px; }

.reactions { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.reaction {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--ink-muted);
  background: var(--surface-2); border: 1px solid var(--hairline);
  border-radius: var(--r-pill); padding: 2px 8px;
  transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.reaction:hover { border-color: var(--hairline-tertiary); }
.reaction.mine { background: rgba(255, 90, 31, 0.15); border-color: var(--primary); color: var(--ink); }

.thread-chip {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 6px;
  font-size: 12px; font-weight: 500; color: var(--primary-hover);
  padding: 4px 8px; border-radius: var(--r-sm);
  border: 1px solid transparent;
  transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.thread-chip:hover { background: var(--surface-2); border-color: var(--hairline); }
.thread-chip .caption { color: var(--ink-tertiary); }

.attachment {
  display: flex; align-items: center; gap: 10px; margin-top: 8px;
  max-width: 340px; padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--hairline);
  border-radius: var(--r-md); cursor: pointer;
  transition: border-color var(--t-fast) var(--ease);
}
.attachment:hover { border-color: var(--hairline-strong); }
.attachment .file-ic {
  width: 32px; height: 32px; border-radius: var(--r-sm); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-4); color: var(--primary-hover); font-size: 13px;
}
.attachment .file-name { font-size: 13px; font-weight: 500; color: var(--ink); }
.attachment .file-meta { font-size: 11px; color: var(--ink-tertiary); }

.typing { display: flex; align-items: center; gap: 8px; padding: 6px var(--s-lg) 4px; font-size: 12px; color: var(--ink-subtle); min-height: 24px; }
.typing .dots { display: inline-flex; gap: 3px; }
.typing .dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--ink-subtle); animation: pulse-dot 1.2s infinite; }
.typing .dots i:nth-child(2) { animation-delay: 0.2s; }
.typing .dots i:nth-child(3) { animation-delay: 0.4s; }

.composer { padding: 0 var(--s-lg) var(--s-md); flex-shrink: 0; }
.composer-box {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: inset 0 1px 0 var(--edge-highlight);
  transition: border-color var(--t-fast) var(--ease), outline var(--t-fast) var(--ease);
}
.composer-box:focus-within { border-color: var(--hairline-strong); outline: 2px solid rgba(255, 90, 31, 0.5); }
.composer-input {
  width: 100%; background: transparent; border: none; resize: none;
  padding: 12px 14px 4px; font-size: 14px; color: var(--ink);
  min-height: 24px; max-height: 200px; overflow-y: auto; outline: none;
  line-height: 1.55; white-space: pre-wrap; overflow-wrap: break-word;
}
/* contenteditable placeholder */
.composer-input.is-empty:before {
  content: attr(data-placeholder);
  color: var(--ink-tertiary); pointer-events: none; cursor: text;
}
/* live formatting rendered inside the editor */
.composer-input b, .composer-input strong { font-weight: 700; color: var(--ink); }
.composer-input i, .composer-input em { font-style: italic; }
.composer-input u { text-decoration: underline; }
.composer-input s, .composer-input strike, .composer-input del { text-decoration: line-through; opacity: 0.75; }
.composer-input a { color: var(--primary-hover); text-decoration: underline; }
.composer-input code {
  font-family: var(--font-mono); font-size: 12px; background: var(--surface-3);
  border: 1px solid var(--hairline); border-radius: var(--r-xs); padding: 1px 5px;
}
.composer-input pre {
  background: var(--surface-3); border: 1px solid var(--hairline); border-radius: var(--r-sm);
  padding: 8px 10px; margin: 4px 0; font-family: var(--font-mono); font-size: 12.5px; white-space: pre-wrap;
}
.composer-input blockquote {
  border-left: 3px solid var(--hairline-strong); padding: 1px 0 1px 10px; margin: 2px 0; color: var(--ink-subtle);
}
.composer-input ul, .composer-input ol { margin: 2px 0; padding-left: 22px; }
.composer-input li { margin: 1px 0; }
.composer-bar { display: flex; align-items: center; gap: 2px; padding: 4px 8px 8px; }
.composer-bar .btn-icon { width: 28px; height: 28px; font-size: 13px; }
.composer-send { margin-left: auto; }
.composer-hint { font-size: 11px; color: var(--ink-tertiary); padding: 6px 4px 0; }

/* Composer formatting toolbar */
.format-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; padding: 6px 8px 2px; border-bottom: 1px solid var(--hairline); }
.format-bar.hidden { display: none; }
.format-bar .btn-icon { width: 26px; height: 26px; font-size: 12px; }
.fmt-sep { width: 1px; height: 16px; background: var(--hairline-strong); margin: 0 5px; flex-shrink: 0; }
.fmt-aa { font-weight: 700; font-size: 13px; letter-spacing: -0.3px; }

/* Inline message editor (edit-in-place) */
.inline-edit { margin: 4px 0 2px; }
.inline-edit .composer-box { background: var(--surface-1); }
.inline-edit .composer-input { max-height: 260px; }

/* Rendered markdown inside messages */
.msg-text .md-line, .msg-text .md-li, .msg-text .md-quote { display: block; }
.msg-text .md-li { padding-left: 2px; }
.msg-text .md-quote { border-left: 3px solid var(--hairline-strong); padding: 1px 0 1px 10px; margin: 2px 0; color: var(--ink-subtle); }
.msg-text a { color: var(--primary-hover); text-decoration: underline; }
.msg-text del { opacity: 0.65; }
.msg-text pre.code-block {
  background: var(--surface-3); border: 1px solid var(--hairline);
  border-radius: var(--r-sm); padding: 8px 10px; margin: 4px 0;
  overflow-x: auto; font-size: 12.5px; line-height: 1.5;
}
.msg-text pre.code-block code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; white-space: pre; }

/* Thread panel */
.thread-msgs { padding: var(--s-md); display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 7px var(--s-md); transition: background-color var(--t-fast) var(--ease); }
.member-row:hover { background: var(--surface-1); }
.member-name { font-size: 14px; font-weight: 500; }
.member-role { font-size: 12px; color: var(--ink-tertiary); }
.panel-section-label { font-size: 11px; font-weight: 500; letter-spacing: 0.4px; text-transform: uppercase; color: var(--ink-tertiary); padding: var(--s-sm) var(--s-md) 4px; }

/* ================= Responsive ================= */
@media (max-width: 1280px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .channel-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: var(--s-xs); }
  .channel-grid { grid-template-columns: 1fr; }
  .chat-scroll { padding: var(--s-sm) var(--s-md); }
  .composer { padding: 0 var(--s-md) var(--s-sm); }
  .chat-header .topic { display: none; }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .auth-card { padding: var(--s-lg); }
}
