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

:root {
    --blue:    #1a6bbf;
    --blue-dk: #145299;
    --red:     #c0392b;
    --green:   #27ae60;
    --grey:    #f4f6f8;
    --border:  #dde1e7;
    --text:    #222;
    --muted:   #666;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    color: var(--text);
    background: var(--grey);
    line-height: 1.5;
}

/* NAV */
.topnav {
    background: var(--blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-brand { font-weight: 700; font-size: 1.05rem; }
.nav-right  { display: flex; align-items: center; gap: 1rem; }
.nav-user   { font-size: .85rem; opacity: .8; }
.nav-link   { color: #fff; text-decoration: none; font-size: .9rem; }
.nav-link:hover { text-decoration: underline; }

/* LAYOUT */
.container { max-width: 1100px; margin: 2rem auto; padding: 0 1.5rem; }

/* LOGIN */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--blue); }
.login-box  { background: #fff; padding: 2.5rem; border-radius: 8px; width: 100%; max-width: 400px; box-shadow: 0 4px 20px rgba(0,0,0,.2); }
.login-box h1 { font-size: 1.4rem; margin-bottom: .25rem; }
.login-box .subtitle { color: var(--muted); margin-bottom: 1.5rem; font-size: .9rem; }

/* PAGE HEADER */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
}
.page-header h2 { font-size: 1.4rem; }
.company-label  { color: var(--muted); font-size: .9rem; }

/* QUOTA */
.quota-bar-wrap { margin-bottom: 1.5rem; }
.quota-label    { font-size: .9rem; color: var(--muted); margin-bottom: .4rem; }
.quota-bar      { height: 10px; background: #dde1e7; border-radius: 5px; overflow: hidden; }
.quota-fill     { height: 100%; background: var(--blue); border-radius: 5px; transition: width .3s; }
.quota-fill.full { background: var(--red); }
.quota-note     { color: var(--muted); font-size: .85rem; margin-bottom: 1rem; }

/* STATS */
.stat-row  { display: flex; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 1.25rem 2rem; text-align: center; min-width: 150px; }
.stat-value { display: block; font-size: 2rem; font-weight: 700; color: var(--blue); }
.stat-label { font-size: .85rem; color: var(--muted); }

/* TABLE */
.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.07); margin-bottom: 1.5rem; }
.data-table th { background: #f0f3f7; text-align: left; padding: .65rem 1rem; font-size: .85rem; color: var(--muted); border-bottom: 1px solid var(--border); }
.data-table td { padding: .65rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr.row-error td { background: #fff5f5; }
.mono { font-family: monospace; font-size: .95rem; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; padding: .55rem 1.1rem; border: none; border-radius: 5px; cursor: pointer; font-size: .9rem; text-decoration: none; font-weight: 500; line-height: 1; transition: background .15s; }
.btn-primary   { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dk); }
.btn-secondary { background: #e8ecf0; color: var(--text); }
.btn-secondary:hover { background: #d8dde3; }
.btn-danger    { background: var(--red); color: #fff; }
.btn-danger:hover { background: #a93226; }
.btn-sm        { padding: .35rem .8rem; font-size: .82rem; }
.btn-full      { width: 100%; justify-content: center; }

/* FORMS */
.form-group  { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .35rem; }
.form-group input,
.form-group select,
.form-group textarea { width: 100%; padding: .55rem .75rem; border: 1px solid var(--border); border-radius: 5px; font-size: .95rem; font-family: inherit; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,107,191,.15); }
.form-group small { color: var(--muted); font-size: .8rem; display: block; margin-top: .25rem; }
.form-actions { display: flex; gap: .75rem; margin-top: 1.25rem; }
.form-card { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 1.5rem; margin-bottom: 1.5rem; }
.form-card h3 { margin-bottom: 1rem; font-size: 1rem; }
.required { color: var(--red); }

/* ALERTS */
.alert { padding: .85rem 1.1rem; border-radius: 6px; margin-bottom: 1rem; font-size: .9rem; }
.alert-error   { background: #fdf2f2; border: 1px solid #f5c6cb; color: #721c24; }
.alert-success { background: #f0fdf4; border: 1px solid #b7efc5; color: #155724; }

/* BADGES */
.badge { display: inline-block; padding: .2rem .6rem; border-radius: 3px; font-size: .75rem; font-weight: 600; margin-left: .4rem; }
.badge-admin { background: #fef3c7; color: #92400e; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 3rem; color: var(--muted); }
.empty-state p { margin-bottom: 1rem; }

/* PAGINATION */
.pagination { display: flex; gap: .4rem; margin-top: 1rem; }
.pagination a { padding: .4rem .75rem; border: 1px solid var(--border); border-radius: 4px; text-decoration: none; color: var(--text); font-size: .85rem; }
.pagination a.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ADMIN ACTIONS */
.admin-actions { margin-top: 2rem; }
.admin-actions h3 { margin-bottom: 1rem; }
.admin-actions .btn { margin-right: .5rem; margin-bottom: .5rem; }
.admin-link-bar { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--border); font-size: .85rem; }

/* DANGER ZONE */
.danger-zone { border-color: var(--red); }
.danger-zone h3 { color: var(--red); }
details summary::-webkit-details-marker { color: var(--red); }
