/* Nusail Engineering Consultancy CRM — glass dashboard theme */

:root {
  --blue-900: #0f2744;
  --blue-800: #153a5f;
  --blue-700: #1e4a7a;
  --blue-500: #2f6fbf;
  --blue-400: #4a8ee0;
  --red-700: #9f1239;
  --red-600: #c81e4a;
  --red-500: #e11d48;
  --white: #ffffff;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.55);
  --text: #0f172a;
  --text-muted: #475569;
  --shadow: 0 18px 50px rgba(15, 39, 68, 0.18);
  --shadow-soft: 0 8px 32px rgba(15, 39, 68, 0.12);
  --radius: 16px;
  --radius-sm: 12px;
  --sidebar-w: 268px;
  --font: "DM Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.app-body {
  background: linear-gradient(135deg, #0c1f35 0%, #153a5f 42%, #1a3a62 55%, #3d0a16 100%);
  background-attachment: fixed;
  position: relative;
}

.app-body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 15% 20%, rgba(74, 142, 224, 0.35), transparent 55%),
    radial-gradient(ellipse 70% 50% at 85% 75%, rgba(225, 29, 72, 0.22), transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 100%, rgba(255, 255, 255, 0.08), transparent 45%);
  pointer-events: none;
  z-index: 0;
}

.login-body {
  min-height: 100vh;
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  position: relative;
  overflow-x: hidden;
}

.login-bg {
  position: fixed;
  inset: 0;
  background: linear-gradient(145deg, #0a1a2e 0%, #153a5f 45%, #4a0d18 100%);
  z-index: 0;
}

.login-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(74, 142, 224, 0.4), transparent 45%),
    radial-gradient(circle at 80% 70%, rgba(225, 29, 72, 0.25), transparent 40%);
}

.login-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.glass-card {
  background: var(--glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.glass-card--pad {
  padding: 1.5rem 1.75rem;
}

.glass-card--table {
  padding: 0;
  overflow: hidden;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 2rem 2rem 1.75rem;
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.login-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--blue-700), var(--red-600));
  color: var(--white);
  font-weight: 700;
  font-size: 1.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(15, 39, 68, 0.25);
}

.login-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--blue-900);
  letter-spacing: -0.02em;
}

.login-subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.login-hint {
  margin: 1.25rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.login-hint code {
  font-size: 0.76rem;
  background: rgba(15, 39, 68, 0.06);
  padding: 0.12rem 0.35rem;
  border-radius: 6px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--blue-800);
}

.req {
  color: var(--red-600);
}

.input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(15, 39, 68, 0.12);
  background: rgba(255, 255, 255, 0.92);
  font: inherit;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(47, 111, 191, 0.2);
}

.textarea {
  resize: vertical;
  min-height: 100px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s, border-color 0.12s;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--blue-700), var(--blue-500));
  color: var(--white);
  box-shadow: 0 6px 20px rgba(21, 58, 95, 0.35);
}

.btn-primary:hover {
  box-shadow: 0 8px 26px rgba(21, 58, 95, 0.42);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(15, 39, 68, 0.12);
  color: var(--blue-800);
}

.btn-secondary:hover {
  background: var(--white);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.35);
  border-color: rgba(255, 255, 255, 0.5);
  color: var(--blue-900);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.55);
}

.btn-block {
  width: 100%;
}

.btn-danger-outline {
  background: rgba(225, 29, 72, 0.08);
  border-color: rgba(225, 29, 72, 0.35);
  color: var(--red-700);
}

.btn-danger-outline:hover {
  background: rgba(225, 29, 72, 0.14);
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.alert-success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #14532d;
}

.alert-error {
  background: rgba(225, 29, 72, 0.12);
  border: 1px solid rgba(225, 29, 72, 0.35);
  color: #7f1d1d;
}

/* App shell */
.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 40;
  opacity: 0;
  transition: opacity 0.2s;
}

.sidebar-overlay.is-visible {
  opacity: 1;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 50;
  box-shadow: 4px 0 32px rgba(15, 39, 68, 0.08);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.35rem 1.25rem;
  border-bottom: 1px solid rgba(15, 39, 68, 0.08);
}

.sidebar-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--blue-800), var(--red-600));
  color: var(--white);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.sidebar-company {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--blue-900);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.sidebar-tag {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--red-600);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--blue-800);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: rgba(47, 111, 191, 0.1);
  color: var(--blue-900);
}

.nav-item.is-active {
  background: linear-gradient(90deg, rgba(47, 111, 191, 0.2), rgba(225, 29, 72, 0.08));
  color: var(--blue-900);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--red-500);
}

.nav-ico {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(21, 58, 95, 0.1);
  color: var(--blue-700);
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-item.is-active .nav-ico {
  background: rgba(225, 29, 72, 0.15);
  color: var(--red-700);
}

.sidebar-footer {
  padding: 1rem 1rem 1.25rem;
  border-top: 1px solid rgba(15, 39, 68, 0.08);
}

.sidebar-user {
  margin-bottom: 0.75rem;
}

.sidebar-user-name {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--blue-900);
}

.sidebar-user-role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.5rem 0.75rem;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  padding: 0 11px;
}

.menu-toggle span {
  display: block;
  height: 2px;
  background: var(--blue-900);
  border-radius: 1px;
}

.topbar-title h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.02em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.topbar-sub {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
}

.content {
  flex: 1;
  padding: 0 1.5rem 2rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.muted {
  color: var(--text-muted);
}

.dashboard-intro {
  margin-bottom: 1.25rem;
}

.dashboard-welcome {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  color: var(--blue-900);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  padding: 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.stat-value--blue {
  color: var(--blue-700);
}

.stat-value--red {
  color: var(--red-600);
}

.stat-value--money {
  font-size: 1.25rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.section-title {
  margin: 0 0 0.85rem;
  font-size: 1rem;
  color: var(--blue-900);
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.workflow-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.workflow-list li {
  margin-bottom: 0.4rem;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.input-search {
  min-width: 220px;
}

.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 0.85rem 1.1rem;
  text-align: left;
  border-bottom: 1px solid rgba(15, 39, 68, 0.08);
}

.data-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.5);
}

.data-table tbody tr:hover {
  background: rgba(47, 111, 191, 0.06);
}

.cell-actions {
  white-space: nowrap;
}

.link {
  color: var(--blue-700);
  font-weight: 600;
  text-decoration: none;
}

.link:hover {
  text-decoration: underline;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-ok {
  background: rgba(34, 197, 94, 0.18);
  color: #14532d;
}

.badge-muted {
  background: rgba(100, 116, 139, 0.2);
  color: #334155;
}

.form-card {
  max-width: 820px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.25rem;
}

.field-span-2 {
  grid-column: span 2;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-top: 0.25rem;
}

.inline-delete {
  margin: 0;
}

/* Mobile */
@media (max-width: 1100px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .field-span-2 {
    grid-column: span 1;
  }
}

@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
  }

  .sidebar-overlay {
    display: block;
    pointer-events: none;
  }

  .sidebar-overlay.is-visible {
    pointer-events: auto;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .topbar {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .content {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
