@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,400&display=swap');

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

:root {
  --black:    #000;
  --white:    #fff;
  --g900:     #111;
  --g800:     #1e1e1e;
  --g700:     #333;
  --g600:     #555;
  --g500:     #777;
  --g400:     #999;
  --g300:     #bbb;
  --g200:     #ddd;
  --g150:     #e5e5e5;
  --g100:     #eee;
  --g75:      #f2f2f2;
  --g50:      #f7f7f7;
  --g25:      #fafafa;

  --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;

  --r-sm:   6px;
  --r:      10px;
  --r-lg:   14px;
  --r-xl:   20px;
  --r-full: 9999px;

  --sh-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --sh:    0 4px 12px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.04);
  --sh-lg: 0 8px 40px rgba(0,0,0,.11), 0 2px 8px rgba(0,0,0,.05);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--white);
  color: var(--black);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ═══ NAV ═══ */
.nav {
  position: sticky; top: 0; z-index: 100;
  height: 60px;
  display: flex; align-items: center;
  border-bottom: 1px solid var(--g150);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.nav-inner {
  max-width: 1140px; margin: 0 auto; padding: 0 24px;
  width: 100%; display: flex; align-items: center;
  justify-content: space-between; gap: 24px;
}
.nav-logo {
  font-weight: 800; font-size: 1.125rem;
  letter-spacing: -.02em; color: var(--black); text-decoration: none;
}
.nav-links { display: flex; gap: 28px; list-style: none; }
.nav-links a {
  font-size: .875rem; font-weight: 500;
  color: var(--g600); text-decoration: none; transition: color .15s;
}
.nav-links a:hover { color: var(--black); }
.nav-cta { display: flex; align-items: center; gap: 10px; }

/* ═══ BUTTONS ═══ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 20px; border-radius: var(--r);
  font-size: .9rem; font-weight: 600; font-family: var(--font);
  cursor: pointer; transition: all .15s ease;
  border: none; text-decoration: none; white-space: nowrap; line-height: 1;
}
.btn-primary { background: var(--black); color: var(--white); }
.btn-primary:hover { background: var(--g800); transform: translateY(-1px); box-shadow: var(--sh); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary { background: var(--white); color: var(--black); border: 1.5px solid var(--g200); }
.btn-secondary:hover { background: var(--g50); }

.btn-ghost { background: transparent; color: var(--g600); border: 1.5px solid transparent; }
.btn-ghost:hover { background: var(--g75); color: var(--black); }

.btn-white { background: var(--white); color: var(--black); }
.btn-white:hover { background: var(--g75); }

.btn-outline-white { background: transparent; color: var(--white); border: 1.5px solid rgba(255,255,255,.3); }
.btn-outline-white:hover { border-color: rgba(255,255,255,.7); background: rgba(255,255,255,.06); }

.btn-danger { background: var(--white); color: #c0392b; border: 1.5px solid #f5c6c6; }
.btn-danger:hover { background: #fff5f5; }

.btn-sm  { padding: 7px 14px; font-size: .8125rem; }
.btn-lg  { padding: 13px 26px; font-size: .9375rem; }
.btn-xl  { padding: 15px 32px; font-size: 1rem; }
.btn-full { width: 100%; }

/* ═══ FORM ═══ */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.label { font-size: .8125rem; font-weight: 600; color: var(--g700); }
.input {
  padding: 11px 14px;
  border: 1.5px solid var(--g200); border-radius: var(--r);
  font-size: .9rem; font-family: var(--font); color: var(--black);
  background: var(--white); outline: none; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--black); box-shadow: 0 0 0 3px rgba(0,0,0,.06); }
.input::placeholder { color: var(--g300); }
.input-hint { font-size: .78rem; color: var(--g400); }

/* ═══ CONTAINERS ═══ */
.container    { max-width: 1140px; margin: 0 auto; padding: 0 24px; }
.container-sm { max-width: 760px;  margin: 0 auto; padding: 0 24px; }
.container-xs { max-width: 480px;  margin: 0 auto; padding: 0 24px; }

/* ═══ AUTH LAYOUT ═══ */
.auth-page {
  min-height: 100vh; display: grid; place-items: center;
  background: var(--g25); padding: 40px 24px;
}
.auth-card {
  background: var(--white); border: 1px solid var(--g150);
  border-radius: var(--r-xl); padding: 40px;
  width: 100%; max-width: 420px; box-shadow: var(--sh-lg);
}
.auth-logo {
  font-size: 1.25rem; font-weight: 800; letter-spacing: -.02em;
  text-decoration: none; color: var(--black); display: block; margin-bottom: 32px;
}
.auth-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; margin-bottom: 6px; }
.auth-subtitle { font-size: .875rem; color: var(--g500); margin-bottom: 28px; }
.auth-footer { text-align: center; margin-top: 24px; font-size: .8125rem; color: var(--g500); }
.auth-footer a { color: var(--black); font-weight: 600; text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }
.auth-sep {
  display: flex; align-items: center; gap: 14px; margin: 20px 0;
  font-size: .75rem; color: var(--g400); font-weight: 500;
}
.auth-sep::before, .auth-sep::after {
  content: ''; flex: 1; height: 1px; background: var(--g150);
}

/* ═══ APP SHELL ═══ */
.app-wrap { display: flex; height: 100vh; overflow: hidden; background: var(--white); }

.sidebar {
  width: 248px; min-width: 248px;
  background: var(--g25); border-right: 1px solid var(--g150);
  display: flex; flex-direction: column; overflow: hidden;
}
.sidebar-top { padding: 14px 12px 10px; border-bottom: 1px solid var(--g150); }
.sidebar-logo {
  font-size: 1rem; font-weight: 800; letter-spacing: -.02em;
  padding: 6px 8px; color: var(--black); text-decoration: none; display: block;
}
.sidebar-body { flex: 1; overflow-y: auto; padding: 8px; }

.sidebar-section-label {
  font-size: .67rem; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--g400); padding: 10px 8px 4px;
}
.sidebar-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 8px; border-radius: var(--r-sm);
  font-size: .845rem; font-weight: 450; color: var(--g600);
  text-decoration: none; cursor: pointer; transition: all .1s; user-select: none;
}
.sidebar-item:hover { background: var(--g100); color: var(--black); }
.sidebar-item.active { background: var(--g100); color: var(--black); font-weight: 600; }
.sidebar-item .ico { width: 14px; height: 14px; opacity: .55; flex-shrink: 0; }
.sidebar-item.active .ico { opacity: 1; }
.sidebar-badge {
  margin-left: auto; font-size: .68rem; color: var(--g400);
  background: var(--g100); padding: 1px 6px; border-radius: var(--r-full);
}
.sidebar-bottom { padding: 8px; border-top: 1px solid var(--g150); }
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: var(--r-sm); cursor: pointer; transition: background .1s;
}
.sidebar-user:hover { background: var(--g100); }
.user-avatar {
  width: 30px; height: 30px; background: var(--black); border-radius: var(--r-full);
  color: var(--white); font-size: .72rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.user-name { font-size: .82rem; font-weight: 600; color: var(--black); line-height: 1.2; }
.user-plan { font-size: .7rem; color: var(--g400); }

/* ═══ APP MAIN ═══ */
.app-main { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.app-header {
  padding: 17px 28px; border-bottom: 1px solid var(--g150);
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-shrink: 0;
}
.app-header-left { display: flex; flex-direction: column; gap: 2px; }
.app-header-title { font-size: 1rem; font-weight: 700; letter-spacing: -.01em; }
.breadcrumb { font-size: .775rem; color: var(--g400); }
.app-header-actions { display: flex; gap: 10px; align-items: center; }
.app-body { padding: 28px; flex: 1; }

/* ═══ CARDS ═══ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.project-card {
  border: 1px solid var(--g150); border-radius: var(--r-lg);
  padding: 18px; cursor: pointer; transition: all .15s;
  background: var(--white); text-decoration: none; color: inherit;
  display: flex; flex-direction: column; gap: 6px;
}
.project-card:hover { border-color: var(--g300); box-shadow: var(--sh); transform: translateY(-1px); }
.project-card-name { font-size: .875rem; font-weight: 700; color: var(--black); }
.project-card-folder { font-size: .72rem; color: var(--g400); }
.project-card-meta { font-size: .72rem; color: var(--g400); margin-top: 2px; }
.project-card-bottom {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto; padding-top: 12px; border-top: 1px solid var(--g100);
}
.project-card-pieces { font-size: .775rem; font-weight: 600; color: var(--g600); }
.card-new {
  border: 1.5px dashed var(--g200); border-radius: var(--r-lg);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 6px; padding: 18px; cursor: pointer;
  color: var(--g400); font-size: .875rem; font-weight: 500;
  min-height: 120px; transition: all .15s;
}
.card-new:hover { border-color: var(--g500); color: var(--g600); background: var(--g25); }
.card-new-plus { font-size: 1.5rem; line-height: 1; }

/* ═══ BADGES ═══ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .7rem; font-weight: 600; padding: 3px 9px;
  border-radius: var(--r-full); border: 1px solid;
}
.badge-active  { background: #f0faf0; color: #2d7c2d; border-color: #c3e6c3; }
.badge-inactive { background: var(--g75); color: var(--g500); border-color: var(--g200); }
.badge-trial   { background: #fdf6e3; color: #8a6d00; border-color: #f0dfa0; }

/* ═══ DIVIDER ═══ */
hr { border: none; height: 1px; background: var(--g150); margin: 24px 0; }

/* ═══ MODAL ═══ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--white); border-radius: var(--r-xl);
  padding: 32px; max-width: 440px; width: 100%; box-shadow: var(--sh-lg);
  transform: translateY(8px); transition: transform .2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-title { font-size: 1.125rem; font-weight: 700; margin-bottom: 8px; }
.modal-body  { font-size: .875rem; color: var(--g600); margin-bottom: 24px; line-height: 1.6; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; }

/* ═══ TABLE ═══ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .845rem; }
thead th {
  padding: 10px 14px; text-align: left;
  font-size: .7rem; font-weight: 700; color: var(--g400);
  text-transform: uppercase; letter-spacing: .05em;
  background: var(--g50); border-bottom: 1px solid var(--g150);
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--g100); color: var(--g700); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--g25); }

/* ═══ TOAST ═══ */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--black); color: var(--white);
  padding: 12px 20px; border-radius: var(--r);
  font-size: .875rem; font-weight: 500; z-index: 9999;
  box-shadow: var(--sh-lg); pointer-events: none;
  animation: toastIn .25s ease, toastOut .25s ease 2.75s forwards;
}
@keyframes toastIn  { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }
@keyframes toastOut { from { opacity:1; transform:none; } to { opacity:0; transform:translateY(8px); } }

/* ═══ UTILS ═══ */
.text-center   { text-align: center; }
.text-muted    { color: var(--g500); }
.text-small    { font-size: .8125rem; }
.font-bold     { font-weight: 700; }
.flex          { display: flex; }
.flex-col      { flex-direction: column; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-5 { gap: 20px; }
.w-full { width: 100%; }
.mt-1 { margin-top:  4px; }
.mt-2 { margin-top:  8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .sidebar   { display: none; }
  .auth-card { padding: 28px 20px; }
  .app-body  { padding: 20px; }
}
