/* ============================================================
   NimaxDocs UI — ActiveCollab-inspired design system
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
  --purple:        #6C47FF;
  --purple-light:  #F0EBFF;
  --purple-hover:  #5A38E0;
  --bg:            #F5F5F7;
  --sidebar-w:     220px;
  --sidebar-bg:    #FFFFFF;
  --border:        #E8E8ED;
  --text:          #1A1A2E;
  --text-muted:    #8A8A9A;
  --text-mid:      #555566;
  --success:       #22C55E;
  --warning:       #F59E0B;
  --danger:        #EF4444;
  --info:          #3B82F6;
  --yellow-hl:     #FFF3B0;
  --radius:        8px;
  --radius-sm:     5px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  margin: 0;
  line-height: 1.5;
}

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

/* ============================================================
   Sidebar
   ============================================================ */

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.sidebar-logo:hover { text-decoration: none; }

.sidebar-logo .logo-icon {
  width: 28px; height: 28px;
  background: var(--purple);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-nav { padding: 0 10px; flex: 1; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-mid);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background .12s, color .12s;
  margin-bottom: 1px;
}
.sidebar-nav a:hover {
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}
.sidebar-nav a.active {
  background: var(--purple-light);
  color: var(--purple);
}
.sidebar-nav a svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .75; }
.sidebar-nav a.active svg { opacity: 1; }

.sidebar-section {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 14px 10px 4px;
}

.sidebar-footer {
  padding: 12px 18px 16px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-muted);
}
.sidebar-footer strong { display: block; color: var(--text); font-size: 13px; }
.sidebar-footer a { color: var(--text-muted); font-size: 12px; }
.sidebar-footer a:hover { color: var(--danger); }

/* ============================================================
   Main layout
   ============================================================ */

.main-wrap {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-header h1 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.page-header .subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

.page-body { padding: 24px 28px; flex: 1; }

/* ============================================================
   Breadcrumb
   ============================================================ */
.ac-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 18px;
}
.ac-breadcrumb a { color: var(--text-muted); }
.ac-breadcrumb a:hover { color: var(--purple); text-decoration: none; }
.ac-breadcrumb .sep { opacity: .4; }

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .12s, box-shadow .12s;
  text-decoration: none;
  line-height: 1.4;
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--purple);
  color: #fff;
  border-color: var(--purple);
}
.btn-primary:hover { background: var(--purple-hover); border-color: var(--purple-hover); color: #fff; }

.btn-outline {
  background: #fff;
  color: var(--text-mid);
  border-color: var(--border);
}
.btn-outline:hover { background: var(--bg); color: var(--text); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 9px 20px; font-size: 14px; }

/* ============================================================
   Task/Contract list (AC-style)
   ============================================================ */

.task-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 10px;
  margin-bottom: 2px;
}
.task-list-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.task-list-count {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 400;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  transition: background .1s;
  cursor: pointer;
}
.task-item:hover { background: #fff; }

.task-check {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .1s;
}
.task-item:hover .task-check { border-color: var(--purple); }
.task-check.done { background: var(--success); border-color: var(--success); }

.task-title {
  flex: 1;
  font-size: 13.5px;
  color: var(--text);
  font-weight: 500;
}
.task-title a { color: var(--text); }
.task-title a:hover { color: var(--purple); text-decoration: none; }

.task-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ============================================================
   Badges / Status labels
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-draft    { background: #F3F4F6; color: #6B7280; }
.badge-client   { background: #EFF6FF; color: #2563EB; }
.badge-revise   { background: #FFFBEB; color: #D97706; }
.badge-legal    { background: #F0EBFF; color: var(--purple); }
.badge-signed   { background: #F0FDF4; color: #16A34A; }
.badge-red      { background: #FEF2F2; color: #DC2626; }
.badge-yellow   { background: #FFFBEB; color: #D97706; }
.badge-green    { background: #F0FDF4; color: #16A34A; }

/* ============================================================
   Card
   ============================================================ */

.ac-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.ac-card-header {
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
}

.ac-card-body { padding: 16px 18px; }

/* ============================================================
   Table
   ============================================================ */

.ac-table { width: 100%; border-collapse: collapse; }
.ac-table th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  background: #FAFAFA;
}
.ac-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  vertical-align: middle;
}
.ac-table tr:last-child td { border-bottom: none; }
.ac-table tbody tr:hover { background: #FAFAFA; }
.ac-table .td-muted { color: var(--text-muted); font-size: 12.5px; }
.ac-table .td-bold { font-weight: 500; }

/* ============================================================
   Forms
   ============================================================ */

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-mid);
  margin-bottom: 5px;
}
.form-control, .form-select {
  width: 100%;
  padding: 8px 11px;
  font-size: 13.5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  transition: border-color .15s;
  outline: none;
  font-family: inherit;
}
.form-control:focus, .form-select:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(108,71,255,.1);
}
.form-control::placeholder { color: var(--text-muted); }
.form-row { display: grid; gap: 14px; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input { width: 15px; height: 15px; accent-color: var(--purple); }

.alert-danger {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #DC2626;
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  font-size: 13px;
}

/* ============================================================
   Empty state
   ============================================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state .empty-icon {
  font-size: 36px;
  margin-bottom: 12px;
  opacity: .4;
}
.empty-state p { margin: 0 0 16px; font-size: 14px; }

/* ============================================================
   Login page
   ============================================================ */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.login-box {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 36px 40px;
  width: 100%;
  max-width: 380px;
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}
.login-logo .logo-icon {
  width: 32px; height: 32px;
  background: var(--purple);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}
.login-logo span { font-size: 16px; font-weight: 600; }
.login-title { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.login-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }

/* ============================================================
   Detail view
   ============================================================ */

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.detail-dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; }
.detail-dt { font-size: 12px; color: var(--text-muted); font-weight: 500; padding-top: 1px; white-space: nowrap; }
.detail-dd { font-size: 13.5px; color: var(--text); margin: 0; }

/* ============================================================
   Search bar
   ============================================================ */

.search-bar {
  display: flex;
  gap: 6px;
  align-items: center;
}
.search-bar .form-control { max-width: 280px; }

/* ============================================================
   Misc utils
   ============================================================ */

.text-muted  { color: var(--text-muted) !important; }
.text-purple { color: var(--purple); }
.fw-medium   { font-weight: 500; }
.fw-semibold { font-weight: 600; }
.d-flex      { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.w-100 { width: 100%; }
