:root {
  --primary: #2c3e50;
  --primary-light: #34495e;
  --accent: #3498db;
  --accent-hover: #2980b9;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --bg: #ecf0f1;
  --card: #fff;
  --text: #2c3e50;
  --text-muted: #7f8c8d;
  --border: #dcdde1;
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* NAV */
nav {
  background: var(--primary);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  box-shadow: 0 2px 4px rgba(0,0,0,.15);
}
nav .brand { color: #fff; font-size: 1.2rem; font-weight: 700; text-decoration: none; }
nav .nav-links { display: flex; gap: .5rem; align-items: center; }
nav .nav-links a {
  color: #bdc3c7;
  text-decoration: none;
  padding: .4rem .8rem;
  border-radius: 4px;
  font-size: .9rem;
  transition: background .2s, color .2s;
}
nav .nav-links a:hover, nav .nav-links a.active { background: var(--primary-light); color: #fff; }
nav .user-info { color: #bdc3c7; font-size: .85rem; }
nav .user-info a { color: var(--warning); margin-left: .5rem; }

/* LAYOUT */
.container { max-width: 1200px; margin: 1.5rem auto; padding: 0 1.5rem; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.6rem; }

/* CARDS */
.card { background: var(--card); border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08); padding: 1.5rem; margin-bottom: 1.5rem; }
.card h2 { font-size: 1.2rem; margin-bottom: 1rem; border-bottom: 2px solid var(--accent); padding-bottom: .5rem; }

/* TABLES */
table { width: 100%; border-collapse: collapse; }
th, td { padding: .6rem .8rem; text-align: left; border-bottom: 1px solid var(--border); font-size: .9rem; }
th { background: var(--primary); color: #fff; font-weight: 600; }
tr:hover { background: #f5f6fa; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* FORMS */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .9rem; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: .5rem .7rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: .9rem;
}
.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(52,152,219,.2);
}
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }

/* BUTTONS */
.btn {
  display: inline-block;
  padding: .5rem 1.2rem;
  border: none;
  border-radius: 4px;
  font-size: .9rem;
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
  transition: background .2s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #219a52; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }

/* STATUS BADGES */
.badge { display: inline-block; padding: .2rem .6rem; border-radius: 12px; font-size: .75rem; font-weight: 600; }
.badge-draft { background: #dfe6e9; color: #636e72; }
.badge-open { background: #ffeaa7; color: #d35400; }
.badge-sent { background: #74b9ff; color: #0652DD; }
.badge-paid { background: #55efc4; color: #00b894; }
.badge-canceled { background: #fab1a0; color: #d63031; }

/* ALERT */
.alert { padding: .8rem 1rem; border-radius: 4px; margin-bottom: 1rem; font-size: .9rem; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* LOGIN */
.login-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: linear-gradient(135deg, var(--primary), var(--accent));
}
.login-box {
  background: #fff; border-radius: 8px; padding: 2.5rem; width: 380px;
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
}
.login-box h1 { text-align: center; margin-bottom: 1.5rem; color: var(--primary); }
.login-box .btn { width: 100%; }

/* DASHBOARD STATS */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--card); border-radius: 8px; padding: 1.2rem; box-shadow: 0 1px 3px rgba(0,0,0,.08); text-align: center; }
.stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--accent); }
.stat-card .stat-label { font-size: .85rem; color: var(--text-muted); margin-top: .3rem; }

/* INVOICE ITEMS TABLE */
#items-table input, #items-table select { font-size: .85rem; padding: .3rem .5rem; }
#items-table .item-desc { min-width: 200px; }

/* UTILITY */
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.flex-end { display: flex; justify-content: flex-end; gap: .5rem; }
