:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #17202a;
  --muted: #6b7280;
  --border: #e2e8f0;
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --success: #188038;
  --danger: #d93025;
  --warning: #b26a00;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 5px 18px rgba(15, 23, 42, 0.06);
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: radial-gradient(circle at top left, #eaf2ff 0, rgba(234,242,255,0) 36%), var(--bg);
  color: var(--text);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; }

.topbar {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 16px rgba(15,23,42,0.04);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  min-width: 250px;
}

.brand img {
  height: 46px;
  width: auto;
  border-radius: 10px;
}

.brand span { display: flex; flex-direction: column; line-height: 1.1; }
.brand b { font-size: 18px; letter-spacing: -0.2px; }
.brand small { color: var(--muted); font-size: 12px; margin-top: 3px; }

nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 11px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid transparent;
  color: #334155;
  font-size: 14px;
  transition: all .15s ease;
}

.nav-link:hover {
  background: #eef4ff;
  border-color: #dbeafe;
  color: var(--primary-dark);
}

.danger-link:hover {
  background: #fff1f2;
  border-color: #fecaca;
  color: var(--danger);
}

.user-chip {
  display: inline-block;
  padding: 8px 11px;
  border-radius: 999px;
  background: #eef2f7;
  color: #475569;
  font-size: 12px;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

.page-head,
.page-actions {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

h1 { margin: 0 0 16px; font-size: 32px; letter-spacing: -0.5px; }
h2 { margin: 0 0 10px; font-size: 20px; letter-spacing: -0.2px; }
h3 { margin: 10px 0; font-size: 16px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-soft);
}

.card.elevated { box-shadow: var(--shadow); }

.login-card {
  max-width: 460px;
  margin: 90px auto;
  text-align: center;
  padding: 34px;
}

.login-logo {
  height: 86px;
  width: auto;
  margin-bottom: 14px;
  border-radius: 12px;
}

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.compact { gap: 8px 14px; }

.form-section {
  padding: 8px 0 20px;
  border-bottom: 1px solid #eef2f7;
  margin-bottom: 20px;
}
.form-section:last-of-type { border-bottom: 0; }

.section-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.section-icon {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: #eef4ff;
  font-size: 20px;
}

label { display: block; font-weight: 700; margin: 12px 0 6px; color: #334155; }
input, select, textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font: inherit;
  background: #fff;
  transition: all .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,115,232,0.12);
}
textarea { min-height: 180px; }
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  background: #f8fafc;
}
.checkbox-row input { width: auto; }
.checkbox-row span { font-weight: 700; color: #334155; }


.btn,
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #111827;
  padding: 10px 13px;
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  transition: all .15s ease;
  min-height: 40px;
}

.icon-btn:not(.labelled) {
  width: 40px;
  padding: 0;
}
.icon-btn.labelled span { font-size: 17px; }
.icon-btn.wide { width: 100%; justify-content: center; margin-top: 12px; }

.btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.08);
}

.btn.primary,
.icon-btn.primary,
.modal-btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn.primary:hover,
.icon-btn.primary:hover,
.modal-btn.primary:hover { background: var(--primary-dark); }

.btn.danger,
.icon-btn.danger,
.modal-btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.icon-btn.accent { background: #fff8e1; border-color: #f4b400; color: #8a5a00; }
.icon-btn.followup { background: #fff8e1; border-color: #f4b400; color: #8a5a00; }
.icon-btn.small, .btn.small { min-height: 34px; width: 34px; padding: 0; border-radius: 10px; font-size: 15px; }

.actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.sticky-actions {
  background: rgba(255,255,255,0.9);
  position: sticky;
  bottom: 0;
  padding-top: 16px;
  border-top: 1px solid #eef2f7;
}

.alert {
  padding: 13px 16px;
  border-radius: 14px;
  margin-bottom: 16px;
  border: 1px solid transparent;
  box-shadow: var(--shadow-soft);
}
.alert.success { background: #e6f4ea; color: #137333; border-color: #c8e6d0; }
.alert.error { background: #fce8e6; color: #c5221f; border-color: #fac7c2; }

.notice { padding: 12px 14px; border-radius: 14px; margin-bottom: 16px; }
.notice.info { background: #eef4ff; color: #174ea6; border: 1px solid #dbeafe; }

.muted { color: var(--muted); font-size: 14px; }

.recommender-picker {
  display: grid;
  grid-template-columns: minmax(240px, 360px) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.selected-list { display: grid; gap: 10px; }
.selected-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px 14px;
  background: #fbfdff;
}
.selected-main { display: flex; align-items: center; gap: 10px; }
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #e8f0fe;
  color: var(--primary);
  font-weight: 800;
}
.selected-actions { display: flex; gap: 6px; }
.mini-icon {
  border: 1px solid #cbd5e1;
  background: #fff;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 800;
}
.mini-icon.danger { color: var(--danger); }
.empty-inline { padding: 14px; border: 1px dashed #cbd5e1; border-radius: 14px; color: var(--muted); background: #f8fafc; }

.attachment-picker { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.attachment-list { margin-top: 16px; }
.attachment-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin: 8px 0;
  font-weight: 500;
}
.attachment-name { overflow-wrap: anywhere; }
.remove-check { display: inline-flex; align-items: center; gap: 8px; color: var(--danger); font-weight: 700; white-space: nowrap; }
.remove-check input { width: auto; }
.attachment-view-list { line-height: 1.9; }

.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; }
.modern-table th,
.modern-table td,
.details th,
.details td {
  border-bottom: 1px solid #edf2f7;
  padding: 13px 12px;
  text-align: left;
  vertical-align: top;
}
.modern-table th { background: #f8fafc; font-size: 13px; color: #475569; }
.details th { width: 220px; color: #475569; background: #f8fafc; }
.action-cell { white-space: nowrap; }

.badge {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  text-transform: capitalize;
}
.badge.pending { background: #fff4df; color: #9b5f00; }
.badge.approved { background: #e6f4ea; color: #137333; }
.badge.rejected { background: #fce8e6; color: #c5221f; }
.badge.draft { background: #eef2ff; color: #3730a3; }
.badge.waiting { background: #f1f5f9; color: #475569; }
.badge.recommended { background: #e6f4ea; color: #137333; }
.badge.success { background: #e6f4ea; color: #137333; }
.badge.muted-badge { background: #f1f5f9; color: #475569; }

.timeline { padding-left: 22px; border-left: 3px solid #e5e7eb; list-style: none; }
.timeline li { position: relative; padding: 0 0 18px 14px; }
.timeline li::before {
  content: '';
  position: absolute;
  left: -29px;
  top: 4px;
  width: 12px;
  height: 12px;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 0 4px #eaf2ff;
}
.comment { margin-top: 8px; padding: 10px; border-radius: 12px; background: #f8fafc; }
.rich-output table { border-collapse: collapse; width: 100%; }
.rich-output table td,
.rich-output table th { border: 1px solid #cbd5e1; padding: 7px; }
.rich-output ul,
.rich-output ol { padding-left: 24px; }

.app-modal-overlay,
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.58);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.app-modal-overlay.show,
.modal-overlay.show { display: flex; }
.app-modal,
.modal-box {
  background: #fff;
  width: 100%;
  max-width: 500px;
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.30);
  overflow: hidden;
}
.app-modal-header,
.modal-header { padding: 18px 22px; border-bottom: 1px solid #eef2f7; font-size: 20px; font-weight: 850; }
.app-modal-body,
.modal-body { padding: 20px 22px; color: #334155; line-height: 1.55; }
.app-modal-footer,
.modal-footer { padding: 16px 22px; border-top: 1px solid #eef2f7; display: flex; justify-content: flex-end; gap: 10px; }
.modal-btn { padding: 10px 15px; border-radius: 12px; border: 1px solid #cbd5e1; background: #fff; cursor: pointer; font-weight: 800; }
.modal-status { margin-top: 14px; padding: 11px 12px; border-radius: 10px; display: none; font-size: 14px; }
.modal-status.show { display: block; }
.modal-status.info { background: #eef4ff; color: #174ea6; }
.modal-status.success { background: #e6f4ea; color: #137333; }
.modal-status.error { background: #fce8e6; color: #c5221f; }

@media (max-width: 900px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  nav { justify-content: flex-start; }
  .grid.two { grid-template-columns: 1fr; }
  .recommender-picker { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .container { padding: 20px 14px 50px; }
  .brand { min-width: 0; }
  .brand img { height: 40px; }
  .nav-link span { display: none; }
  h1 { font-size: 26px; }
  .card { padding: 16px; }
  .selected-item, .attachment-row { align-items: flex-start; flex-direction: column; }
}

