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

:root {
  --brand:       #981B1D;
  --brand-dark:  #7a1517;
  --brand-bg:    rgba(152,27,29,.07);
  --brand-pale:  #fef2f2;
  --sidebar-w:   220px;
  --header-h:    44px;
  --toolbar-h:   40px;
  --gray-50:     #f7f7f9;
  --gray-100:    #f0f0f2;
  --gray-200:    #e4e4e7;
  --gray-400:    #a1a1aa;
  --gray-500:    #71717a;
  --gray-700:    #3f3f46;
  --gray-900:    #18181b;
  --border:      #e4e4e7;
  --shadow:      0 1px 3px rgba(0,0,0,.06);
}

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

html, body { height: 100%; overflow: hidden; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  color: var(--gray-900);
  background: #fff;
  -webkit-font-smoothing: antialiased;
}

/* ─── App shell ─── */
.nc-app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── Sidebar ─── */
.nc-sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--gray-50);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.nc-sidebar-top {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
}
.nc-sidebar-logo {
  width: 28px; height: 28px;
  background: var(--brand);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; flex-shrink: 0;
}
.nc-sidebar-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--gray-900);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nc-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

/* Workspace section */
.nc-nav-ws {
  margin-bottom: 2px;
}
.nc-nav-ws-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 6px;
  margin: 0 6px;
  color: var(--gray-700);
  font-weight: 500;
  font-size: 13px;
  transition: background .12s;
  user-select: none;
}
.nc-nav-ws-header:hover { background: var(--gray-100); }
.nc-nav-ws-header.active { color: var(--brand); }
.nc-nav-ws-header i.ws-icon { font-size: 13px; }
.nc-nav-ws-header .chevron {
  margin-left: auto;
  font-size: 10px;
  color: var(--gray-400);
  transition: transform .15s;
}
.nc-nav-ws-header.open .chevron { transform: rotate(90deg); }

/* View items inside a workspace */
.nc-nav-views {
  display: none;
  padding: 2px 0 4px 28px;
}
.nc-nav-views.open { display: block; }

.nc-nav-view {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px 5px 8px;
  cursor: pointer;
  border-radius: 5px;
  margin: 1px 6px;
  color: var(--gray-500);
  font-size: 12.5px;
  font-weight: 400;
  background: transparent;
  border: none;
  width: calc(100% - 12px);
  text-align: left;
  transition: background .12s, color .12s;
}
.nc-nav-view:hover { background: var(--gray-100); color: var(--gray-700); }
.nc-nav-view.active {
  background: var(--brand-bg);
  color: var(--brand);
  font-weight: 500;
}
.nc-nav-view i { font-size: 12px; }

/* Sidebar bottom user area */
.nc-sidebar-user {
  border-top: 1px solid var(--border);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nc-user-avatar {
  width: 26px; height: 26px;
  background: var(--brand);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 600; flex-shrink: 0;
}
.nc-user-email {
  font-size: 11.5px;
  color: var(--gray-500);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nc-logout-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  font-size: 14px;
  padding: 2px;
  border-radius: 4px;
  transition: color .12s, background .12s;
}
.nc-logout-btn:hover { color: var(--gray-700); background: var(--gray-100); }

/* ─── Main content area ─── */
.nc-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
}

/* ─── Breadcrumb header ─── */
.nc-header {
  height: var(--header-h);
  min-height: var(--header-h);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 8px;
  background: #fff;
}
.nc-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--gray-500);
}
.nc-breadcrumb .bc-icon { font-size: 13px; color: var(--brand); }
.nc-breadcrumb .bc-sep { color: var(--gray-400); font-size: 11px; }
.nc-breadcrumb .bc-ws { color: var(--gray-500); font-weight: 400; }
.nc-breadcrumb .bc-view { color: var(--gray-900); font-weight: 500; }
.nc-header-right { margin-left: auto; display: flex; gap: 6px; }

/* ─── Toolbar ─── */
.nc-toolbar {
  height: var(--toolbar-h);
  min-height: var(--toolbar-h);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 8px;
  background: #fff;
  flex-wrap: nowrap;
  overflow: visible;
}

.nc-toolbar-divider {
  width: 1px; height: 18px;
  background: var(--border);
  flex-shrink: 0;
  margin: 0 2px;
}

/* ─── Form controls ─── */
.nc-select, .nc-input {
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
  font-family: inherit;
  color: var(--gray-700);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 5px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.nc-select {
  padding-right: 24px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 7px center;
}
.nc-select:focus, .nc-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(152,27,29,.1);
}

.nc-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.nc-search-wrap .nc-search-icon {
  position: absolute;
  left: 8px;
  color: var(--gray-400);
  font-size: 11px;
  pointer-events: none;
}
.nc-search-wrap .nc-input { padding-left: 26px; }

/* ─── Buttons ─── */
.nc-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  border-radius: 5px;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  transition: background .12s, border-color .12s;
  flex-shrink: 0;
}
.nc-btn i { font-size: 12px; }

.nc-btn-primary { background: var(--brand); color: #fff; }
.nc-btn-primary:hover { background: var(--brand-dark); }

.nc-btn-default { background: #fff; color: var(--gray-700); border: 1px solid var(--border); }
.nc-btn-default:hover { background: var(--gray-50); }

.nc-btn-ghost { background: transparent; color: var(--gray-500); border: 1px solid transparent; }
.nc-btn-ghost:hover { background: var(--gray-100); color: var(--gray-900); border-color: var(--border); }

.nc-btn-danger { background: transparent; color: #dc2626; border: 1px solid #fecaca; padding: 0 7px; height: 24px; font-size: 11px; }
.nc-btn-danger:hover { background: #fef2f2; }

/* ─── Table area ─── */
.nc-table-wrap {
  flex: 1;
  overflow: auto;
}

.nc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.nc-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--gray-50);
  color: var(--gray-500);
  font-weight: 500;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .35px;
  padding: 0 12px;
  height: 32px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  white-space: nowrap;
  text-align: left;
  user-select: none;
}
.nc-table th:last-child { border-right: none; }
.nc-table th.num { text-align: right; }

.nc-table td {
  padding: 0 12px;
  height: 32px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  white-space: nowrap;
  color: var(--gray-700);
  font-size: 13px;
}
.nc-table td:last-child { border-right: none; }
.nc-table td:first-child { color: var(--gray-900); font-weight: 500; }
.nc-table td.num { text-align: right; font-variant-numeric: tabular-nums; color: var(--gray-700); }

.nc-table tbody tr:hover td { background: var(--gray-50) !important; }
.nc-table tbody tr.row-clickable { cursor: pointer; }

.nc-table tbody tr.row-total td {
  background: #fefce8 !important;
  font-weight: 600;
  color: var(--gray-900);
}
.nc-table tbody tr.row-total:hover td { background: #fef9c3 !important; }

/* payout cells */
.nc-table td.cell-payout {
  cursor: pointer;
  color: var(--brand);
  font-weight: 500;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.nc-table td.cell-payout:hover { background: var(--brand-pale) !important; text-decoration: underline; }

/* invoice url */
.nc-table td.cell-link a { color: var(--brand); text-decoration: none; font-size: 11px; }
.nc-table td.cell-link a:hover { text-decoration: underline; }

/* row number col */
.nc-table th.col-num, .nc-table td.col-num {
  color: var(--gray-400);
  font-size: 11px;
  text-align: right;
  width: 44px;
  min-width: 44px;
  font-weight: 400;
}

/* ─── Login screen ─── */
.nc-login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: var(--gray-50);
}
.nc-login-card {
  width: 340px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 36px 32px;
  text-align: center;
  box-shadow: var(--shadow);
}
.nc-login-icon {
  width: 42px; height: 42px;
  background: var(--brand-pale);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: var(--brand); font-size: 18px;
  margin: 0 auto 14px;
}
.nc-login-card h5 { font-size: 15px; font-weight: 600; margin-bottom: 6px; color: var(--gray-900); }
.nc-login-card p  { font-size: 12px; color: var(--gray-500); margin-bottom: 20px; }

/* ─── Modals ─── */
.modal-content { border: 1px solid var(--border) !important; border-radius: 8px !important; }
.modal-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--gray-50);
  border-radius: 8px 8px 0 0;
}
.modal-title { font-size: 13px; font-weight: 600; color: var(--gray-900); }
.modal-body { padding: 16px; }
.modal-section-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .4px;
  color: var(--gray-400); margin-bottom: 8px; margin-top: 4px;
}

/* ─── Admin panel ─── */
.nc-admin-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 4px;
  background: var(--gray-50);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 7px 7px 0 0;
}
.nc-admin-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-500);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  margin-bottom: -1px;
}
.nc-admin-tab:hover { color: var(--gray-700); }
.nc-admin-tab-active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 600;
}

.nc-admin-card {
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
}
.nc-admin-card-header {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 14px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--border);
  font-size: 12px; font-weight: 600; color: var(--gray-700);
}
.nc-admin-add-form {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 14px;
  background: var(--gray-50);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.nc-admin-inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.nc-admin-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  background: var(--gray-200);
  color: var(--gray-500);
  font-size: 11px;
  font-weight: 500;
  border-radius: 10px;
  margin-left: 6px;
}

.nc-admin-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 16px;
  color: var(--gray-400);
}
.nc-admin-empty p { font-size: 12px; margin: 0; }

.badge-ws  { display:inline-block;padding:1px 6px;border-radius:3px;font-size:11px;font-weight:500;background:#dbeafe;color:#1e40af; }
.badge-dash{ display:inline-block;padding:1px 6px;border-radius:3px;font-size:11px;font-weight:500;background:#ede9fe;color:#5b21b6; }

/* ─── Download dropdown ─── */
.nc-download-wrap {
  position: relative;
}
.nc-download-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  z-index: 1000;
  min-width: 160px;
  padding: 4px;
}
.nc-download-menu.open { display: block; }
.nc-download-menu button {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  font-family: inherit;
  color: var(--gray-700);
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
}
.nc-download-menu button:hover { background: var(--gray-100); }
.nc-download-menu button i { font-size: 12px; color: var(--gray-500); }

/* ─── Access denied banner ─── */
.nc-access-denied {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 24px 20px;
  margin: 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 7px;
  color: #991b1b;
}
.nc-access-denied i {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}
.nc-access-denied strong {
  font-size: 13px;
  font-weight: 600;
  display: block;
  margin-bottom: 3px;
}
.nc-access-denied p {
  font-size: 12px;
  margin: 0;
  color: #b91c1c;
}

/* ─── Format toggle ─── */
.nc-fmt-toggle {
  display: flex;
  align-items: center;
  background: var(--gray-100);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px;
  gap: 2px;
  cursor: pointer;
  user-select: none;
}
.fmt-opt {
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 500;
  color: var(--gray-500);
  border-radius: 3px;
  transition: background .12s, color .12s;
}
.fmt-opt.active {
  background: #fff;
  color: var(--gray-900);
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}

/* ─── Column tooltip ─── */
.col-tip {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  position: relative;
  cursor: default;
  vertical-align: middle;
}
.col-tip i {
  font-size: 10px;
  color: var(--gray-400);
  transition: color .12s;
}
.col-tip:hover i { color: var(--gray-600); }

.col-tip::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-900);
  color: #fff;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.45;
  padding: 6px 10px;
  border-radius: 5px;
  white-space: normal;
  width: 240px;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.col-tip::before {
  content: "";
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: var(--gray-900);
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 200;
}
.col-tip:hover::after,
.col-tip:hover::before { opacity: 1; }

/* ─── Spinner ─── */
.nc-spinner {
  width: 13px; height: 13px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Toast ─── */
#errorToast { border-radius: 6px; font-size: 12px; }
