:root{
  --bg:#f6fbfb;
  --panel:#ffffff;
  --panel-2:#f9fbfb;
  --text:#0f172a;
  --muted:#64748b;
  --border:#e2e8f0;
  --accent:#00b3a4;
  --accent-2:#009e90;
  --shadow:0 12px 35px rgba(2,8,23,.08);

  --sidebar:#ffffff;
  --sidebar-text:#334155;
}

body.dark-mode{
  --bg:#0b1220;
  --panel:#121a2b;
  --panel-2:#0f172a;
  --text:#e2e8f0;
  --muted:#94a3b8;
  --border:#23314b;
  --accent:#00e0c7;
  --accent-2:#00c7b0;
  --shadow:0 18px 40px rgba(0,0,0,.35);

  --sidebar:#0f172a;
  --sidebar-text:#cbd5e1;
}

*{ box-sizing:border-box; }

body{
  margin:0;
  font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
}

/* ================= TOAST NOTIFICATIONS - FULL WIDTH ================= */
.toast-notification{
  position:fixed;
  top:0;
  left:50%;
  transform:translateX(-50%) translateY(-100px);
  width:100%;
  max-width:600px;
  padding:18px 24px;
  border-radius:0 0 12px 12px;
  font-size:15px;
  font-weight:500;
  text-align:center;
  z-index:9999;
  box-shadow:0 4px 20px rgba(0,0,0,.15);
  opacity:0;
  transition:all 0.4s ease;
}

.toast-notification.show{
  transform:translateX(-50%) translateY(0);
  opacity:1;
}

.toast-success{
  background:#d1fae5;
  color:#065f46;
  border:1px solid #10b981;
}

.toast-error{
  background:#fee2e2;
  color:#991b1b;
  border:1px solid #ef4444;
}

/* ================= LOGIN ================= */

.login-wrapper{
  display:flex;
  justify-content:center;
  align-items:center;
  min-height:100vh;
  padding:40px 20px;
}

.login-card{
  width:420px;
  background:var(--panel);
  padding:50px 45px;
  border-radius:18px;
  border:1px solid var(--border);
  box-shadow:var(--shadow);
}

.login-title{
  margin:0;
  font-size:22px;
  letter-spacing:1px;
  text-align:center;
  color:var(--accent);
}

.login-sub{
  text-align:center;
  margin-top:8px;
  margin-bottom:30px;
  font-size:14px;
  color:var(--muted);
}

.field{
  margin-bottom:20px;
}

.login-btn{
  width:100%;
  margin-top:10px;
}

.login-theme{
  margin-top:30px;
}

/* ================= FORMS ================= */

input,
textarea,
select{
  width:100%;
  padding:14px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--panel-2);
  color:var(--text);
  font-size:14px;
  transition:.2s;
}

textarea{
  resize:vertical;
  min-height:120px;
}

input:focus,
textarea:focus,
select:focus{
  outline:none;
  border-color:var(--accent);
  box-shadow:0 0 0 2px rgba(0,179,164,.15);
}

/* ================= BUTTONS ================= */

.btn{
  padding:14px 20px;
  border-radius:12px;
  border:none;
  cursor:pointer;
  font-weight:600;
  font-size:14px;
  transition:.2s;
  display:inline-block;
  text-decoration:none;
}

.btn-primary{
  background:var(--accent);
  color:white;
}

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

.btn-ghost{
  background:transparent;
  border:1px solid var(--border);
  color:var(--text);
}

.btn-ghost:hover{
  border-color:var(--accent);
  color:var(--accent);
}

.btn-danger{
  background:#ef4444;
  color:white;
  border:none;
}

.btn-danger:hover{
  background:#dc2626;
}

/* ================= ALERT ================= */

.alert{
  background:#fee2e2;
  color:#991b1b;
  padding:12px;
  border-radius:10px;
  margin-bottom:20px;
  font-size:14px;
}

.success-alert{
  background:#d1fae5;
  color:#065f46;
  border:1px solid #10b981;
}

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

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

.sidebar{
  width:240px;
  background:var(--sidebar);
  border-right:1px solid var(--border);
  padding:30px 20px;
}

.brand{
  font-weight:800;
  letter-spacing:2px;
  color:var(--accent);
  font-size:22px;
  margin-bottom:25px;
}

.nav a{
  display:block;
  padding:10px 12px;
  margin-bottom:6px;
  border-radius:8px;
  text-decoration:none;
  color:var(--sidebar-text);
}

.nav a:hover{
  background:rgba(0,179,164,.10);
  color:var(--accent);
}

.spacer{
  flex:1;
}

.theme-toggle{
  margin-top:20px;
  padding:10px 12px;
  border-radius:8px;
  border:1px solid var(--border);
  cursor:pointer;
  color:var(--accent);
  text-align:center;
}

.main{
  flex:1;
  padding:60px;
}

.shell{
  max-width:1100px;
  margin:0 auto;
}

.card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:16px;
  padding:40px;
  box-shadow:var(--shadow);
}

/* ================= INVOICE PAGES ================= */

.invoice-header{
  display:flex;
  justify-content:space-between;
  gap:60px;
  margin-bottom:40px;
}

.two-col{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:25px;
}

.right-stack{
  width:260px;
  display:flex;
  flex-direction:column;
  gap:15px;
  align-items:flex-end;
}

.invoice-title{
  margin:0 0 10px 0;
  font-size:36px;
  font-weight:600;
  letter-spacing:2px;
}

/* ================= TABLE ================= */

.table{
  width:100%;
  border-collapse:collapse;
  margin-top:15px;
}

.table th{
  text-align:left;
  padding:14px;
  background:var(--accent);
  color:white;
  font-size:13px;
}

.table td{
  padding:14px;
  border-bottom:1px solid var(--border);
  word-break:break-word;
}

.table tr:hover{
  background:rgba(0,179,164,.05);
}

.table a{
  text-decoration:none;
  font-weight:500;
}

.table a:hover{
  color:var(--accent);
}

.col-qty{ width:120px; }
.col-rate{ width:140px; }
.col-amt{ width:140px; }
.col-x{ width:60px; }

/* ================= INVOICE FOOTER ================= */

.invoice-footer{
  display:grid;
  grid-template-columns:2fr 1fr;
  gap:50px;
  margin-top:40px;
}

.section-title{
  font-weight:600;
  margin-bottom:15px;
  font-size:15px;
}

.totals{
  display:flex;
  flex-direction:column;
  gap:14px;
}

.totals .line{
  display:flex;
  justify-content:space-between;
  align-items:center;
}

.totals .line input{
  width:110px;
}

.total-line{
  padding-top:12px;
  border-top:1px solid var(--border);
  font-size:16px;
}

.row-actions{
  display:flex;
  justify-content:space-between;
  margin-top:20px;
}

/* ================= DROPDOWN - POLISHED ================= */

.action-cell{
  text-align:right;
  position:relative;
}

.dropdown{
  position:relative;
  display:inline-block;
}

.action-btn{
  padding:8px 14px;
  font-size:16px;
  line-height:1;
  border-radius:8px;
  transition:all 0.2s;
  white-space:nowrap;
  min-width:48px;
  letter-spacing:2px;
}

.action-btn:hover{
  background:rgba(0,179,164,.08);
  border-color:var(--accent);
}

.dropdown-menu{
  position:absolute;
  right:0;
  top:calc(100% + 6px);
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:12px;
  box-shadow:0 8px 24px rgba(0,0,0,.12);
  min-width:180px;
  display:none;
  flex-direction:column;
  overflow:hidden;
  z-index:100;
}

.dropdown-menu.show{
  display:flex;
}

.dropdown-menu a{
  padding:14px 18px;
  text-decoration:none;
  color:var(--text);
  font-size:14px;
  font-weight:500;
  border-bottom:1px solid var(--border);
  transition:all 0.15s;
  white-space:nowrap;
  display:flex;
  align-items:center;
  gap:10px;
}

.dropdown-menu a:last-child{
  border-bottom:none;
}

.dropdown-menu a:hover{
  background:rgba(0,179,164,.08);
  color:var(--accent);
  padding-left:22px;
}

.dropdown-menu a.danger{
  color:#ef4444;
}

.dropdown-menu a.danger:hover{
  background:rgba(239,68,68,.08);
  color:#dc2626;
}

/* ================= MODAL ================= */

.modal{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.6);
  align-items:center;
  justify-content:center;
  z-index:999;
}

.modal-content{
  background:var(--panel);
  padding:35px 35px 30px 35px;
  border-radius:18px;
  width:420px;
  border:1px solid var(--border);
  box-shadow:var(--shadow);
}

.modal-content h3{
  margin-top:0;
  margin-bottom:20px;
}

.modal-content input{
  margin-top:6px;
}

.modal-content form{
  margin-top:10px;
}

/* ================= RESPONSIVE ================= */

@media(max-width:900px){
  .invoice-header{
    flex-direction:column;
  }

  .invoice-footer{
    grid-template-columns:1fr;
  }

  .two-col{
    grid-template-columns:1fr;
  }
  
  .toast-notification{
    max-width:90%;
  }
}