* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f5f6f8;
    color: #1c1e21;
}

h1 { font-size: 1.4rem; }
h2 { font-size: 1.05rem; }

.portal-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.portal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
    padding: 0 1.75rem;
    background: #4C2FAF;
    color: #fbfbfb;
}

.portal-header-brand {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.3rem;
}

.portal-logo-link {
    display: block;
    line-height: 0;
}

.portal-logo {
    max-height: 36px;
    width: auto;
    display: block;
}

.portal-company {
    font-size: 0.85rem;
    color: #fbfbfb;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.portal-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.portal-nav a {
    color: #e0d9f2;
    text-decoration: none;
    font-size: 0.9rem;
}

.portal-nav a.active {
    color: #fbfbfb;
    font-weight: 600;
}

.link-button {
    background: none;
    border: none;
    color: #e0d9f2;
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    padding: 0;
}

.link-button:hover { color: #fbfbfb; }

.portal-main {
    flex: 1;
    padding: 1.5rem;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.login-card {
    max-width: 360px;
    margin: 4rem auto;
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.login-card label {
    display: block;
    margin-top: 1rem;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.login-card input {
    display: block;
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

.login-card button, .invite-panel button {
    margin-top: 1.25rem;
    padding: 0.5rem 1rem;
    background: #4C2FAF;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
}

.login-card button:not(:disabled):hover, .invite-panel button:not(:disabled):hover {
    background: #3B2489;
}

.invite-panel button { margin-top: 0; }

.login-card button:disabled, .invite-panel button:disabled {
    opacity: 0.6;
    cursor: default;
}

.alert {
    padding: 0.6rem 0.9rem;
    border-radius: 4px;
    margin: 0.75rem 0;
    font-size: 0.9rem;
}

.alert-error { background: #fdecea; color: #b3261e; }
.alert-success { background: #e7f6ec; color: #1e7a34; }

.status-pill {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-active { background: #e7f6ec; color: #1e7a34; }
.status-inactive { background: #fdecea; color: #b3261e; }

.invite-panel {
    background: #fff;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.invite-panel form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.5rem;
}

.invite-panel input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

.people-table, .usage-table, .standards-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.people-table th, .people-table td,
.usage-table th, .usage-table td,
.standards-table th, .standards-table td {
    padding: 0.6rem 0.9rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.people-table th, .usage-table th, .standards-table th {
    background: #F1EDFB;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #666;
}

.license-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.usage-total {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.usage-total-number { font-size: 2rem; font-weight: 700; }
.usage-total-label { color: #666; }

.usage-range {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    background: #fff;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.usage-range label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: #666;
}

.usage-range input[type="date"] {
    padding: 0.4rem 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95rem;
    font-family: inherit;
}

.usage-range button {
    padding: 0.5rem 1rem;
    background: #4C2FAF;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
}

.usage-range button:not(:disabled):hover { background: #3B2489; }
.usage-range button:disabled { opacity: 0.6; cursor: default; }

.usage-by-person-heading { margin-top: 2rem; }

.usage-by-person-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.usage-by-person-table th.sortable:hover { color: #4C2FAF; }

.standard-card {
    background: #fff;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.standard-card button:not(.reset-button) {
    padding: 0.5rem 1rem;
    background: #4C2FAF;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
}

.standard-card button:not(.reset-button):disabled {
    opacity: 0.6;
    cursor: default;
}

.standard-card button:not(.reset-button):not(:disabled):hover {
    background: #3B2489;
}

.standards-table button {
    padding: 0.3rem 0.7rem;
    background: #fff;
    color: #4C2FAF;
    border: 1px solid #4C2FAF;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.standards-table button:not(:disabled):hover {
    background: #F1EDFB;
}

.standards-table button:disabled {
    opacity: 0.5;
    cursor: default;
}

.standard-meta {
    font-size: 0.85rem;
    color: #666;
}

.standard-textarea {
    display: block;
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    margin-top: 0.5rem;
}

.char-count {
    text-align: right;
    font-size: 0.8rem;
    color: #888;
    margin: 0.25rem 0 0.75rem;
}

.char-count-over { color: #b3261e; font-weight: 600; }

.status-default {
    background: #eef1f5;
    color: #45505c;
}

/* Deliberately a distinct color from the primary (blue) action buttons
   elsewhere in the portal -- Reset to Default is a different kind of
   action (stop customizing) from Save or Revert (change which
   customization is active), and shouldn't be styled like just another
   button in the same row. */
.reset-button {
    background: #fff;
    color: #b3261e;
    border: 1px solid #b3261e;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
}

.reset-button:disabled {
    opacity: 0.5;
    cursor: default;
}

.dashboard-strip {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.dashboard-card {
    background: #fff;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.dashboard-strip .dashboard-card {
    margin-bottom: 0;
}

.dashboard-loading {
    color: #666;
    font-size: 0.9rem;
}

.dashboard-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.dashboard-toggle-button {
    padding: 0.4rem 0.8rem;
    background: #fff;
    color: #4C2FAF;
    border: 1px solid #4C2FAF;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    white-space: nowrap;
}

.dashboard-toggle-button:hover { background: #F1EDFB; }

.dashboard-bar-chart {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.dashboard-bar-row {
    display: grid;
    grid-template-columns: 110px 1fr 40px;
    align-items: center;
    gap: 0.75rem;
}

.dashboard-bar-label {
    font-size: 0.85rem;
    color: #666;
}

.dashboard-bar-track {
    background: #F1EDFB;
    border-radius: 4px;
    height: 20px;
    overflow: hidden;
}

.dashboard-bar-fill {
    background: #4C2FAF;
    height: 100%;
    border-radius: 4px;
    min-width: 2px;
    transition: width 0.2s ease;
}

.dashboard-bar-value {
    font-weight: 600;
    text-align: right;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 0.75rem;
}

.dashboard-stat {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.dashboard-stat-number { font-size: 2rem; font-weight: 700; }
.dashboard-stat-label { color: #666; font-size: 0.85rem; }

.dashboard-nav-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 0.5rem;
}

.dashboard-nav-card {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    background: #fff;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    text-decoration: none;
    color: inherit;
}

.dashboard-nav-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.dashboard-nav-title {
    font-weight: 600;
    color: #4C2FAF;
}

.dashboard-nav-context {
    font-size: 0.85rem;
    color: #666;
}
