/* ==========================================================================
   Amogh ERP — shared stylesheet (login, signup, dashboard)
   ========================================================================== */

:root {
  --primary: #4a4dbc;
  --primary-dark: #363990;
  --primary-light: #6f72d6;
  --accent: #f15a24;
  --danger: #ed1c24;
  --success: #16a34a;
  --warning: #d97706;

  --bg: #f2f4f9;
  --card-bg: #ffffff;
  --text: #1f2430;
  --text-muted: #6b7280;
  --border: #e5e7eb;

  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 10px 30px rgba(20, 24, 46, 0.08);
  --shadow-lg: 0 20px 45px rgba(20, 24, 46, 0.16);

  --rail-bg: #146a99;
  --rail-bg-dark: #0f4f73;
}

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

body {
  font-family: "Inter", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

ul {
  list-style: none;
}

.hidden {
  display: none !important;
}

.error-message {
  color: var(--danger);
  font-size: 12.5px;
  margin-top: 4px;
  min-height: 16px;
}

.field-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ==========================================================================
   Auth pages (login / signup) — two-card gradient layout
   ========================================================================== */

.auth-page {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  background: radial-gradient(circle at top left, #313663, #14172a 70%);
}

.auth-wrap {
  display: flex;
  align-items: stretch;
  width: 100%;
  max-width: 900px;
}

.auth-brand-card {
  flex: 1 1 340px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 48px 36px;
  border-radius: var(--radius-lg);
  color: #fff;
  background: linear-gradient(130deg, var(--danger), var(--primary) 45%, var(--primary) 60%, var(--accent));
  box-shadow: var(--shadow-lg);
}

.auth-brand-card .brand-mark {
  width: 68px;
  height: 68px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 18px;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.auth-brand-card h1 {
  font-size: 26px;
  margin-bottom: 8px;
}

.auth-brand-card p {
  font-size: 14.5px;
  opacity: 0.9;
  margin-bottom: 26px;
  max-width: 280px;
}

.btn-ghost-white {
  display: inline-block;
  padding: 12px 34px;
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.5px;
  transition: background 0.2s ease, transform 0.15s ease;
}

.btn-ghost-white:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.auth-form-card {
  flex: 1 1 380px;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  box-shadow: var(--shadow-lg);
  margin-left: -28px;
  z-index: 2;
  transform: scale(0.99);
  transition: transform 0.15s ease;
}

.auth-form-card:hover {
  transform: scale(1);
}

.auth-form-card h2 {
  font-size: 22px;
  text-align: center;
  margin-bottom: 6px;
}

.auth-form-card .sub {
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
  margin-bottom: 22px;
}

.input-container {
  position: relative;
  margin: 14px 0;
}

.input-container .icon {
  position: absolute;
  left: 12px;
  top: 13px;
  color: #a3a8ba;
  font-size: 14px;
}

.input-container .eye-icon {
  position: absolute;
  right: 12px;
  top: 13px;
  color: #a3a8ba;
  cursor: pointer;
  font-size: 14px;
  user-select: none;
}

.userinput {
  width: 100%;
  padding: 11px 14px 11px 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14.5px;
  background: #fbfbfd;
}

.userinput:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}

.row-2 {
  display: flex;
  gap: 12px;
}

.row-2 .input-container {
  flex: 1;
}

.options-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  margin: 10px 0 4px;
}

.options-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.forgot-link {
  color: var(--primary);
  font-weight: 600;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  margin-top: 12px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.2s ease;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.auth-switch {
  text-align: center;
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 18px;
}

.auth-switch a {
  color: var(--primary);
  font-weight: 700;
}

.auth-footer-note {
  text-align: center;
  margin-top: 22px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

@media (max-width: 760px) {
  .auth-wrap {
    flex-direction: column;
    max-width: 420px;
  }
  .auth-form-card {
    margin-left: 0;
    margin-top: -16px;
  }
}

/* ==========================================================================
   Modal (password reset, add/edit user)
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 33, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-card {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-card.wide {
  max-width: 560px;
}

.modal-head {
  padding: 22px 26px 14px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.modal-head h2 {
  font-size: 19px;
}

.modal-head p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 18px;
  border: none;
  background: none;
  font-size: 20px;
  color: var(--text-muted);
  line-height: 1;
}

.modal-body {
  padding: 20px 26px 26px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-body label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  margin-top: 14px;
}

.modal-body label:first-child {
  margin-top: 0;
}

.modal-body select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fbfbfd;
}

.modal-actions {
  margin-top: 22px;
  display: flex;
  gap: 10px;
}

.btn {
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  border: none;
}

.btn-solid {
  background: var(--primary);
  color: #fff;
}

.btn-solid:hover {
  background: var(--primary-dark);
}

.btn-outline {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover {
  background: #f6f7fb;
}

.btn-danger-outline {
  background: #fff;
  border: 1px solid #f3c8c9;
  color: var(--danger);
}

.btn-danger-outline:hover {
  background: #fdf2f2;
}

/* ==========================================================================
   Dashboard shell
   ========================================================================== */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: 62px;
  background: linear-gradient(100deg, var(--danger), var(--primary) 45%, var(--primary) 60%, var(--accent));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 15;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.topbar-business {
  color: #fff;
  font-weight: 700;
  font-size: 15.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.topbar-icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.topbar-icon-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.notif-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  background: #fff;
  color: var(--danger);
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.profile-dropdown {
  position: relative;
}

.profile-trigger {
  display: flex;
  align-items: center;
  gap: 9px;
  border: none;
  background: transparent;
  padding: 5px 10px 5px 5px;
  border-radius: 999px;
  cursor: pointer;
  color: #fff;
}

.profile-trigger:hover {
  background: rgba(255, 255, 255, 0.14);
}

.profile-name {
  font-size: 13.5px;
  font-weight: 600;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 230px;
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 40;
}

.profile-menu-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.profile-menu-head .value {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 6px;
}

.profile-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  border: none;
  background: #fff;
  font-size: 13.5px;
  color: var(--text);
  cursor: pointer;
}

.profile-menu-item i {
  width: 16px;
  color: var(--text-muted);
}

.profile-menu-item:hover {
  background: #f5f6fa;
}

.profile-menu-item.danger {
  color: var(--danger);
}

.profile-menu-item.danger i {
  color: var(--danger);
}

.subnav-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 22px;
  overflow-x: auto;
  flex-shrink: 0;
}

.subnav-tab {
  border: none;
  background: transparent;
  padding: 13px 16px 11px;
  font-size: 13.8px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  white-space: nowrap;
}

.subnav-tab:hover {
  color: var(--text);
}

.subnav-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.role-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.role-owner {
  background: #fde3d0;
  color: #b3480a;
}

.role-admin {
  background: #dfe1fb;
  color: var(--primary-dark);
}

.role-agent {
  background: #dcf5e3;
  color: #157a3a;
}

.content {
  flex: 1;
  padding: 26px;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-head h2 {
  font-size: 20px;
}

.page-head p {
  color: var(--text-muted);
  font-size: 13.5px;
  margin-top: 3px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin-bottom: 26px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  color: #fff;
  flex-shrink: 0;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
}

.stat-label {
  font-size: 12.5px;
  color: var(--text-muted);
}

.panel {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 22px;
}

.panel-title {
  font-size: 15.5px;
  font-weight: 700;
  margin-bottom: 14px;
}

.table-wrap {
  overflow-x: auto;
  scrollbar-color: #c3cadb #f3f4f8;
  scrollbar-width: thin;
}

.table-wrap::-webkit-scrollbar {
  height: 9px;
}

.table-wrap::-webkit-scrollbar-track {
  background: #f3f4f8;
  border-radius: 6px;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: #c3cadb;
  border-radius: 6px;
}

table {
  width: 100%;
  min-width: max-content;
  border-collapse: collapse;
  font-size: 13.8px;
}

thead th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: #fff;
}

tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: none;
}

/* Keep the Actions column reachable without scrolling the whole table */
thead th:last-child,
tbody td:last-child {
  position: sticky;
  right: 0;
  background: #fff;
  box-shadow: -6px 0 8px -6px rgba(15, 23, 42, 0.12);
}

.status-pill {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}

.status-active {
  background: #dcf5e3;
  color: #157a3a;
}

.status-inactive {
  background: #fbe0e1;
  color: #a3161c;
}

.status-pending {
  background: #fef3c7;
  color: #92400e;
}

.status-invited {
  background: #e0e7ff;
  color: #3730a3;
}

.copy-link-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.copy-link-row input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: #fbfbfd;
  color: var(--text);
}

.copy-link-row button {
  flex-shrink: 0;
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
}

.copy-link-row button:hover {
  background: var(--primary-dark);
}

.row-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  color: var(--text-muted);
}

.icon-btn:hover {
  background: #f4f5fa;
  color: var(--text);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state .big-icon {
  font-size: 30px;
  margin-bottom: 10px;
  opacity: 0.5;
}

.toast {
  position: fixed;
  bottom: 26px;
  right: 26px;
  background: #1c2135;
  color: #fff;
  padding: 13px 20px;
  border-radius: 9px;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.25s ease;
  pointer-events: none;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.error {
  background: var(--danger);
}

.toast.success {
  background: var(--success);
}

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: 640px;
}

.profile-field label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.profile-field .value {
  font-size: 14.5px;
  font-weight: 600;
}

@media (max-width: 900px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }
}

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

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--rail-bg);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 25;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.sidebar-brand .brand-mark-sm {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 10px 14px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
  scrollbar-width: thin;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.35);
  border-radius: 4px;
}

.sidebar-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.14);
  margin: 8px 4px;
  flex-shrink: 0;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.sidebar-item i {
  width: 16px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
}

.sidebar-item:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.sidebar-item.active {
  background: rgba(255, 255, 255, 0.24);
  color: #fff;
  font-weight: 700;
}

.sidebar-item-bottom {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.sidebar-toggle-btn {
  display: none;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 24;
  background: rgba(15, 23, 42, 0.4);
}

@media (max-width: 900px) {
  .sidebar-toggle-btn {
    display: flex;
  }

  .sidebar {
    position: fixed;
    left: -220px;
    box-shadow: 6px 0 24px rgba(15, 23, 42, 0.25);
    transition: left 0.2s ease;
  }

  .sidebar.open {
    left: 0;
  }
}

/* Which workspace you're in (Owner / HR / Manager / Employee) */
.sidebar-workspace {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 12px 4px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* A login page that is just one card (staff.html) */
.auth-wrap-single { max-width: 420px; }
.auth-wrap-single .auth-form-card { margin-left: 0; }

/* "Mera aaj" (employee home) */
.myday-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; margin-bottom: 18px; }
.myday-grid .panel { margin-bottom: 0; }

/* second row of tabs under a top-level item (Construction -> Finance -> Invoices ...) */
.subnav-children { background: var(--bg, #f6f7fb); padding-top: 2px; }
.subnav-children .subnav-tab { padding: 8px 14px 7px; font-size: 12.8px; font-weight: 600; }

/* full-page forms (Construction: projects, sites, contractors) */
.cf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px 18px; }
.cf-field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.cf-field select, .cf-field .userinput { width: 100%; box-sizing: border-box; }
.cf-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.cf-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.cf-field select { height: 42px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: #fafafc; font: inherit; font-size: 14px; color: var(--text); }
.cf-field select:focus { outline: none; border-color: var(--primary); }
