/* ============================================================
   WEB MANAGER PRO — styles.css
   ============================================================ */

/* ---- RESET ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--color-primary); text-decoration: none; }
img, svg { display: block; max-width: 100%; }
ul { list-style: none; }
input, select, textarea, button { font: inherit; }

/* ---- CSS CUSTOM PROPERTIES ---- */
:root {
  --color-bg:           #0f172a;
  --color-surface:      #1e293b;
  --color-surface-2:    #2d3f55;
  --color-surface-3:    #334155;
  --color-border:       #334155;
  --color-border-light: #475569;
  --color-text:         #f1f5f9;
  --color-text-muted:   #94a3b8;
  --color-text-subtle:  #64748b;
  --color-primary:      #6366f1;
  --color-primary-h:    #818cf8;
  --color-primary-d:    #4f46e5;
  --color-success:      #22c55e;
  --color-warning:      #f59e0b;
  --color-danger:       #ef4444;
  --color-info:         #38bdf8;
  --sidebar-w:          250px;
  --header-h:           64px;
  --radius-sm:          4px;
  --radius-md:          8px;
  --radius-lg:          12px;
  --radius-xl:          16px;
  --shadow-sm:          0 1px 2px rgba(0,0,0,.3);
  --shadow-md:          0 4px 12px rgba(0,0,0,.4);
  --shadow-lg:          0 8px 30px rgba(0,0,0,.5);
  --transition:         150ms ease;
}

/* ============================================================
   LAYOUT
   ============================================================ */

/* Login layout */
body.layout-login {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at top, #1e1b4b 0%, #0f172a 60%);
  padding: 24px;
}

/* App layout */
body.layout-app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 100vh;
  overflow: hidden;
}

.sidebar {
  background: #111827;
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
  z-index: 10;
}

.main-wrap {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: var(--header-h);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}

.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--color-border);
}

.sidebar-logo-mark {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.sidebar-logo-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
}
.sidebar-logo-text span {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--color-text-muted);
}

.sidebar-nav {
  padding: 12px 8px;
  flex: 1;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--color-text-subtle);
  padding: 12px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  margin-bottom: 2px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: var(--color-surface-2); color: var(--color-text); }
.nav-item.active { background: rgba(99,102,241,.15); color: var(--color-primary-h); }
.nav-item.active .nav-item-icon { color: var(--color-primary); }

.nav-item-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-item-badge {
  margin-left: auto;
  background: var(--color-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  line-height: 1.5;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--color-border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition);
}
.sidebar-user:hover { background: var(--color-surface-2); }

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 11px;
  color: var(--color-text-muted);
  text-transform: capitalize;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.breadcrumb { font-size: 14px; color: var(--color-text-muted); display: flex; align-items: center; gap: 6px; }
.breadcrumb-sep { color: var(--color-text-subtle); }
.breadcrumb-current { color: var(--color-text); font-weight: 500; }

/* ============================================================
   AVATAR
   ============================================================ */
.avatar {
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
  text-transform: uppercase;
}
.avatar-sm  { width: 28px; height: 28px; font-size: 11px; }
.avatar-md  { width: 36px; height: 36px; font-size: 13px; }
.avatar-lg  { width: 48px; height: 48px; font-size: 17px; }
.avatar-xl  { width: 64px; height: 64px; font-size: 22px; }

/* Avatar colors by first letter */
.avatar-a,.avatar-b { background: #6366f1; }
.avatar-c,.avatar-d { background: #8b5cf6; }
.avatar-e,.avatar-f { background: #ec4899; }
.avatar-g,.avatar-h { background: #f43f5e; }
.avatar-i,.avatar-j { background: #f97316; }
.avatar-k,.avatar-l { background: #eab308; }
.avatar-m,.avatar-n { background: #22c55e; }
.avatar-o,.avatar-p { background: #06b6d4; }
.avatar-q,.avatar-r { background: #3b82f6; }
.avatar-s,.avatar-t { background: #14b8a6; }
.avatar-u,.avatar-v { background: #84cc16; }
.avatar-w,.avatar-x { background: #f59e0b; }
.avatar-y,.avatar-z { background: #ef4444; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--color-primary); color: #fff; }
.btn-primary:hover:not(:disabled)  { background: var(--color-primary-d); }
.btn-danger   { background: var(--color-danger); color: #fff; }
.btn-danger:hover:not(:disabled)   { background: #dc2626; }
.btn-success  { background: var(--color-success); color: #fff; }
.btn-success:hover:not(:disabled)  { background: #16a34a; }
.btn-ghost    { background: transparent; border-color: var(--color-border-light); color: var(--color-text-muted); }
.btn-ghost:hover:not(:disabled)    { background: var(--color-surface-2); color: var(--color-text); }
.btn-surface  { background: var(--color-surface-2); color: var(--color-text); border-color: var(--color-border); }
.btn-surface:hover:not(:disabled)  { background: var(--color-surface-3); }
.btn-icon {
  padding: 6px 8px;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover { background: var(--color-surface-2); color: var(--color-text); border-color: var(--color-border-light); }
.btn-icon.danger:hover { background: rgba(239,68,68,.1); color: var(--color-danger); border-color: var(--color-danger); }
.btn-icon.success { color: var(--color-success); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 11px 24px; font-size: 15px; }
.btn-block { width: 100%; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

label, .form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-hint { font-size: 11px; color: var(--color-text-subtle); margin-top: 4px; }

.input, .select, .textarea {
  display: block;
  width: 100%;
  padding: 9px 12px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.2);
}
.input::placeholder, .textarea::placeholder { color: var(--color-text-subtle); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.textarea { resize: vertical; min-height: 80px; }

.input-group { display: flex; }
.input-group .input { border-radius: var(--radius-md) 0 0 var(--radius-md); flex: 1; }
.input-group .btn-icon { border-radius: 0 var(--radius-md) var(--radius-md) 0; border-left: none; padding: 0 12px; }

.form-error { font-size: 12px; color: var(--color-danger); margin-top: 4px; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-header-left { display: flex; align-items: center; gap: 10px; }
.card-title { font-size: 15px; font-weight: 700; color: var(--color-text); }
.card-subtitle { font-size: 12px; color: var(--color-text-muted); }
.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--color-border);
  background: rgba(0,0,0,.15);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* ============================================================
   BADGES / STATUS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-active    { color: var(--color-success); background: rgba(34,197,94,.12); }
.badge-inactive  { color: var(--color-text-muted); background: rgba(148,163,184,.12); }
.badge-prospect  { color: var(--color-info); background: rgba(56,189,248,.12); }
.badge-archived  { color: var(--color-text-subtle); background: rgba(100,116,139,.12); }
.badge-planning  { color: var(--color-text-muted); background: rgba(148,163,184,.12); }
.badge-on-hold   { color: var(--color-warning); background: rgba(245,158,11,.12); }
.badge-completed { color: var(--color-success); background: rgba(34,197,94,.12); }
.badge-cancelled { color: var(--color-danger); background: rgba(239,68,68,.12); }
.badge-admin     { color: #a78bfa; background: rgba(167,139,250,.12); }
.badge-manager   { color: var(--color-info); background: rgba(56,189,248,.12); }
.badge-viewer    { color: var(--color-text-muted); background: rgba(148,163,184,.12); }
.badge-website   { color: var(--color-primary-h); background: rgba(99,102,241,.12); }
.badge-webapp    { color: #c084fc; background: rgba(192,132,252,.12); }
.badge-ecommerce { color: var(--color-warning); background: rgba(245,158,11,.12); }
.badge-maintenance { color: var(--color-info); background: rgba(56,189,248,.12); }
.badge-seo       { color: var(--color-success); background: rgba(34,197,94,.12); }
.badge-other     { color: var(--color-text-muted); background: rgba(148,163,184,.12); }

/* ============================================================
   STATS GRID
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-card-icon.indigo  { background: rgba(99,102,241,.15);  color: var(--color-primary-h); }
.stat-card-icon.emerald { background: rgba(34,197,94,.15);   color: var(--color-success); }
.stat-card-icon.amber   { background: rgba(245,158,11,.15);  color: var(--color-warning); }
.stat-card-icon.sky     { background: rgba(56,189,248,.15);  color: var(--color-info); }
.stat-card-info {}
.stat-card-value { font-size: 28px; font-weight: 800; color: var(--color-text); line-height: 1; }
.stat-card-label { font-size: 12px; color: var(--color-text-muted); margin-top: 4px; }

/* ============================================================
   CLIENT CARDS
   ============================================================ */
.client-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.client-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.client-card:hover {
  border-color: var(--color-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.client-card-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.client-card-info { flex: 1; min-width: 0; }
.client-card-name { font-size: 15px; font-weight: 700; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-card-company { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }
.client-card-meta { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }

.client-card-detail { font-size: 12px; color: var(--color-text-subtle); margin-bottom: 4px; display: flex; gap: 6px; }
.client-card-detail strong { color: var(--color-text-muted); font-weight: 500; min-width: 52px; }

.client-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.page-header-left {}
.page-title { font-size: 22px; font-weight: 800; color: var(--color-text); }
.page-subtitle { font-size: 13px; color: var(--color-text-muted); margin-top: 2px; }
.page-header-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* ============================================================
   FILTERS / SEARCH BAR
   ============================================================ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.search-input-wrap { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--color-text-subtle); font-size: 14px; pointer-events: none; }
.search-input { padding-left: 34px !important; }

.filter-tabs { display: flex; gap: 4px; }
.filter-tab {
  padding: 5px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  transition: all var(--transition);
}
.filter-tab:hover { background: var(--color-surface-2); color: var(--color-text); }
.filter-tab.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

/* ============================================================
   CLIENT DETAIL
   ============================================================ */
.client-detail-hero {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}
.client-detail-info { flex: 1; min-width: 0; }
.client-detail-name { font-size: 24px; font-weight: 800; color: var(--color-text); }
.client-detail-company { font-size: 15px; color: var(--color-text-muted); margin-top: 2px; }
.client-detail-badges { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.client-detail-contacts { display: flex; gap: 20px; margin-top: 14px; flex-wrap: wrap; }
.client-contact-item { font-size: 13px; color: var(--color-text-muted); display: flex; gap: 6px; align-items: center; }

.client-notes-card {
  background: rgba(99,102,241,.06);
  border: 1px solid rgba(99,102,241,.2);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* ============================================================
   PROJECTS
   ============================================================ */
.projects-section { margin-top: 24px; }

.project-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
  transition: border-color var(--transition);
}
.project-card:hover { border-color: var(--color-border-light); }

.project-card-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}
.project-card-header:hover { background: rgba(255,255,255,.02); }
.project-info { flex: 1; min-width: 0; }
.project-name { font-size: 15px; font-weight: 700; color: var(--color-text); }
.project-meta-row { display: flex; gap: 10px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.project-date { font-size: 11px; color: var(--color-text-subtle); }
.project-expand-icon { color: var(--color-text-subtle); font-size: 12px; transition: transform var(--transition); }
.project-card.expanded .project-expand-icon { transform: rotate(180deg); }

.project-card-body {
  display: none;
  padding: 0 20px 20px;
  border-top: 1px solid var(--color-border);
}
.project-card.expanded .project-card-body { display: block; }

.project-description { font-size: 13px; color: var(--color-text-muted); margin-bottom: 16px; margin-top: 14px; line-height: 1.6; white-space: pre-wrap; }
.project-dates-row { display: flex; gap: 24px; margin-bottom: 16px; }
.project-date-item label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--color-text-subtle); display: block; margin-bottom: 2px; }
.project-date-item span { font-size: 13px; color: var(--color-text-muted); }

.project-card-actions { display: flex; gap: 6px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--color-border); }

/* ============================================================
   CREDENTIALS
   ============================================================ */
.cred-section { margin-top: 16px; }
.cred-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.cred-section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--color-text-subtle); }

.cred-list { display: flex; flex-direction: column; gap: 8px; }

.cred-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.cred-type-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
  background: var(--color-surface-2);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  min-width: 90px;
  justify-content: center;
}
.cred-label { font-size: 13px; font-weight: 600; color: var(--color-text); min-width: 120px; }
.cred-fields { display: flex; gap: 8px; align-items: center; flex: 1; flex-wrap: wrap; }
.cred-field {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 12px;
  min-width: 100px;
}
.cred-field-label { color: var(--color-text-subtle); font-size: 10px; font-weight: 600; text-transform: uppercase; margin-right: 2px; }
.cred-field-value { color: var(--color-text-muted); font-family: ui-monospace, monospace; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 120px; }
.cred-pw-field { font-family: ui-monospace, monospace; font-size: 12px; }

.cred-actions { display: flex; gap: 4px; margin-left: auto; }

.cred-copy-btn.copied { color: var(--color-success) !important; }

/* ============================================================
   TEAM PAGE
   ============================================================ */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.team-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}
.team-card-name { font-size: 15px; font-weight: 700; color: var(--color-text); }
.team-card-email { font-size: 12px; color: var(--color-text-muted); }
.team-card-actions { display: flex; gap: 6px; margin-top: 4px; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 120ms ease;
}
.modal-overlay.hidden { display: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 180ms ease;
}
.modal-lg { max-width: 700px; }

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 17px; font-weight: 700; color: var(--color-text); }
.modal-close {
  background: none;
  border: none;
  color: var(--color-text-subtle);
  cursor: pointer;
  font-size: 20px;
  padding: 4px;
  line-height: 1;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
}
.modal-close:hover { color: var(--color-text); }

.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ============================================================
   TOASTS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}
.toast {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--color-text);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideUp 200ms ease;
  border-left: 3px solid var(--color-primary);
}
.toast-success { border-left-color: var(--color-success); }
.toast-error   { border-left-color: var(--color-danger); }
.toast-warning { border-left-color: var(--color-warning); }
.toast-info    { border-left-color: var(--color-info); }
.toast-icon    { font-size: 16px; }
.toast-msg     { flex: 1; }
.toast-close   { cursor: pointer; color: var(--color-text-subtle); font-size: 16px; padding: 0 4px; background: none; border: none; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  justify-content: center;
}
.login-logo-icon {
  width: 48px;
  height: 48px;
  background: var(--color-primary);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
  font-weight: 800;
}
.login-logo-text { font-size: 22px; font-weight: 800; color: var(--color-text); }
.login-logo-sub  { font-size: 12px; color: var(--color-text-muted); margin-top: 1px; }
.login-title     { font-size: 20px; font-weight: 700; color: var(--color-text); margin-bottom: 6px; text-align: center; }
.login-subtitle  { font-size: 13px; color: var(--color-text-muted); margin-bottom: 28px; text-align: center; }
.login-error     { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3); border-radius: var(--radius-md); padding: 10px 14px; font-size: 13px; color: var(--color-danger); margin-bottom: 16px; text-align: center; }

/* ============================================================
   TABS
   ============================================================ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--color-border); margin-bottom: 20px; }
.tab-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
}
.tab-btn:hover { color: var(--color-text); }
.tab-btn.active { color: var(--color-primary-h); border-bottom-color: var(--color-primary); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--color-text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 14px; opacity: .4; }
.empty-state-title { font-size: 16px; font-weight: 700; color: var(--color-text); margin-bottom: 6px; }
.empty-state-desc  { font-size: 13px; color: var(--color-text-muted); margin-bottom: 20px; }

/* ============================================================
   DIVIDER
   ============================================================ */
.divider { border: none; border-top: 1px solid var(--color-border); margin: 16px 0; }

/* ============================================================
   UTILITIES
   ============================================================ */
.flex   { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: 4px; }
.gap-sm { gap: 8px; }
.gap-md { gap: 12px; }
.gap-lg { gap: 16px; }
.mt-xs { margin-top: 4px; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }
.ml-auto { margin-left: auto; }
.w-full { width: 100%; }
.text-sm   { font-size: 12px; }
.text-muted { color: var(--color-text-muted); }
.text-subtle { color: var(--color-text-subtle); }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-primary { color: var(--color-primary-h); }
.font-bold { font-weight: 700; }
.monospace { font-family: ui-monospace, monospace; }
.hidden { display: none !important; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.break-all { word-break: break-all; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-border-light); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  body.layout-app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    overflow: auto;
  }
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    z-index: 200;
    transition: transform var(--transition);
    width: var(--sidebar-w);
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main-wrap { height: 100vh; }
  .page-content { padding: 16px; }
  .client-grid { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .cred-card { flex-direction: column; align-items: flex-start; }
  .client-detail-hero { flex-direction: column; }
  .client-detail-contacts { flex-direction: column; gap: 8px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: 28px 20px; }
}

/* ============================================================
   INFRA GRID (Hosting / Domain / SSL)
   ============================================================ */
.infra-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0;
}
@media (max-width: 900px) { .infra-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .infra-grid { grid-template-columns: 1fr; } }

.infra-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}
.infra-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.infra-icon { font-size: 14px; }
.infra-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-text-subtle);
  flex: 1;
}
.infra-alert {
  font-size: 10px;
  font-weight: 700;
  color: var(--color-danger);
  background: rgba(239,68,68,.1);
  padding: 2px 6px;
  border-radius: 4px;
}
.infra-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}
.infra-key {
  font-size: 10px;
  color: var(--color-text-subtle);
  min-width: 64px;
  flex-shrink: 0;
}
.infra-val {
  font-size: 12px;
  color: var(--color-text-muted);
  font-weight: 500;
  word-break: break-all;
}

/* Provider badges inside infra cards */
.provider-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}
.provider-badge.hosting { background: rgba(56,189,248,.12); color: var(--color-info); }
.provider-badge.domain  { background: rgba(99,102,241,.12); color: var(--color-primary-h); }
.provider-badge.ssl     { background: rgba(34,197,94,.12);  color: var(--color-success); }

/* Provider + expiry pills shown in the collapsed project card header row */
.provider-pills-row, .expiry-pills-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}
.provider-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}
.provider-pill.hosting { background: rgba(56,189,248,.12); color: var(--color-info); }
.provider-pill.domain  { background: rgba(99,102,241,.12); color: var(--color-primary-h); }
.expiry-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(239,68,68,.1);
  white-space: nowrap;
}

/* ============================================================
   PROJECT FINANCE BOX
   ============================================================ */
.project-finance-box {
  background: rgba(99,102,241,.06);
  border: 1px solid rgba(99,102,241,.18);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin: 14px 0;
}
.project-finance-row {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.project-finance-item { display: flex; flex-direction: column; gap: 2px; }
.project-finance-item label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-text-subtle);
  margin-bottom: 0;
}
.project-finance-item span {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

/* ============================================================
   PRINT / INVOICE
   ============================================================ */
@media print {
  body * { visibility: hidden; }
  #invoice-print-area, #invoice-print-area * { visibility: visible; }
  #invoice-print-area {
    position: absolute;
    left: 0; top: 0;
    width: 100%;
    padding: 20px !important;
    background: #fff !important;
    color: #111 !important;
  }
  .sidebar, .topbar, .page-header, .toast-container, .modal-overlay { display: none !important; }
}

/* ============================================================
   INFRASTRUCTURE — SERVERS
   ============================================================ */
.infra-server-list { display: flex; flex-direction: column; gap: 14px; }

.server-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition);
}
.server-card:hover { border-color: var(--color-border-light); }

.server-card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}

.server-type-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.server-type-icon.indigo  { background: rgba(99,102,241,.15);  color: var(--color-primary-h); }
.server-type-icon.sky     { background: rgba(56,189,248,.15);  color: var(--color-info); }
.server-type-icon.emerald { background: rgba(34,197,94,.15);   color: var(--color-success); }
.server-type-icon.amber   { background: rgba(245,158,11,.15);  color: var(--color-warning); }

.server-card-body { padding: 16px 20px; }

.server-spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px 16px;
}
.spec-block {}
.spec-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-text-subtle);
  margin-bottom: 3px;
}
.spec-value {
  font-size: 13px;
  color: var(--color-text-muted);
  font-weight: 500;
}
.ip-value {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ============================================================
   INFRASTRUCTURE — DOMAINS TABLE
   ============================================================ */
.domain-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.domain-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}
.domain-table thead tr {
  background: var(--color-surface-2);
}
.domain-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-text-subtle);
  border-bottom: 1px solid var(--color-border);
}
.domain-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-muted);
  vertical-align: middle;
}
.domain-table tbody tr:last-child td { border-bottom: none; }
.domain-table tbody tr:hover td { background: rgba(255,255,255,.02); }
