* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #fff;
    color: #333;
    font-family:
        Arial,
        Helvetica,
        sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

a {
    color: #555;
    text-decoration: none;
}

a:hover {
    color: #222;
    text-decoration: underline;
}

.site-header {
    border-bottom: 1px solid #ddd;
    background: #fff;
}

.container {
    width: calc(100% - 40px);
    max-width: 900px;
    margin: 0 auto;
}

.header-inner {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.logo {
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.logo:hover {
    text-decoration: none;
}

nav {
    display: flex;
    align-items: center;
    gap: 18px;
}

main {
    padding-top: 40px;
    padding-bottom: 40px;
}

.card {
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
    padding: 30px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #fff;
}

h1 {
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 24px;
    font-weight: 600;
}

h2 {
    margin-top: 30px;
    font-size: 18px;
    font-weight: 600;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 6px;
    color: #444;
    font-weight: 600;
}

input {
    display: block;
    width: 100%;
    padding: 10px 11px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: #fff;
    color: #333;
    font: inherit;
}

input:focus {
    outline: none;
    border-color: #888;
}

small {
    display: block;
    margin-top: 5px;
    color: #777;
}

button,
.button {
    display: inline-block;
    padding: 9px 16px;
    border: 1px solid #aaa;
    border-radius: 3px;
    background: #f5f5f5;
    color: #333;
    font: inherit;
    cursor: pointer;
}

button:hover,
.button:hover {
    background: #e9e9e9;
    text-decoration: none;
}

.message {
    margin-bottom: 20px;
    padding: 10px 12px;
    border: 1px solid;
    border-radius: 3px;
}

.error {
    border-color: #e2b8b8;
    background: #fdf3f3;
    color: #a00000;
}

.success {
    border-color: #b8d8bf;
    background: #f2faf4;
    color: #176b2c;
}

.inline-form {
    display: inline;
}

.link-button {
    padding: 0;
    border: 0;
    background: transparent;
    color: #555;
}

.link-button:hover {
    background: transparent;
    color: #222;
    text-decoration: underline;
}



@media (max-width: 600px) {

    .container {
        width: calc(100% - 30px);
    }

    .header-inner {
        min-height: 55px;
    }

    nav {
        gap: 12px;
    }

    .card {
        padding: 22px;
    }

    main {
        padding-top: 25px;
    }
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 25px;
}

.page-header h1 {
    margin-bottom: 5px;
}

.muted {
    margin: 0;
    color: #777;
}

.site-list {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #fff;
}

.site-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 20px;
    border-bottom: 1px solid #ddd;
}

.site-row:last-child {
    border-bottom: 0;
}

.site-name {
    margin-bottom: 5px;
    font-weight: 600;
}

.site-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: #777;
    font-size: 13px;
}

.site-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    white-space: nowrap;
}

.status {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 7px;
    border: 1px solid;
    border-radius: 3px;
    font-size: 12px;
    font-weight: normal;
}

.status.active {
    border-color: #b8d8bf;
    background: #f2faf4;
    color: #176b2c;
}

.status.inactive {
    border-color: #ddd;
    background: #f5f5f5;
    color: #777;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.button.secondary {
    background: #fff;
}

.readonly-value {
    padding: 10px 11px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #f7f7f7;
    color: #555;
    font-family: monospace;
}

@media (max-width: 600px) {

    .page-header {
        align-items: stretch;
        flex-direction: column;
    }

    .page-header .button {
        align-self: flex-start;
    }

    .site-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .site-actions {
        width: 100%;
    }

}

select {
    display: block;
    width: 100%;
    padding: 10px 11px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: #fff;
    color: #333;
    font: inherit;
}

select:focus {
    outline: none;
    border-color: #888;
}

.info {
    border-color: #c7d6e3;
    background: #f4f8fb;
    color: #345;
}

.temporary-password {
    margin-top: 10px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #fff;
    color: #222;
    font-family: monospace;
    font-size: 16px;
    word-break: break-all;
}

.card hr {
    margin: 30px 0;
    border: 0;
    border-top: 1px solid #ddd;
}

.site-permissions {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.permission-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 0;
    padding: 14px 15px;
    border-bottom: 1px solid #ddd;
    font-weight: normal;
    cursor: pointer;
}

.permission-item:last-child {
    border-bottom: 0;
}

.permission-item input {
    width: auto;
    margin: 3px 0 0;
}

.permission-item span {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.permission-item strong {
    color: #333;
    font-weight: 600;
}

.permission-item small {
    margin: 0;
    color: #777;
    font-size: 13px;
}

.list-filter {
    margin-bottom: 20px;
    color: #666;
    font-size: 14px;
}

.list-filter label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.list-filter input[type="checkbox"] {
    margin: 0;
}

.history-list {
    border: 1px solid #ddd;
    border-radius: 3px;
    overflow: hidden;
}

.history-header,
.history-row {
    display: grid;
    grid-template-columns: 180px 1.5fr 1fr 160px;
    gap: 20px;
    padding: 12px 15px;
    align-items: center;
}

.history-header {
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    color: #666;
    font-size: 13px;
    font-weight: 600;
}

.history-row {
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.history-row:last-child {
    border-bottom: 0;
}

.history-user strong {
    display: block;
    font-weight: 500;
}

.history-user span {
    display: block;
    margin-top: 2px;
    color: #777;
    font-size: 13px;
}

.history-ip {
    color: #666;
    font-family: monospace;
    font-size: 13px;
}

.history-deleted {
    color: #999;
    font-style: italic;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e5e5e5;
    white-space: nowrap;
}

.data-table th {
    background: #f7f7f7;
    color: #555;
    font-weight: 600;
}

.data-table tbody tr:hover {
    background: #fafafa;
}

.event-label {
    display: inline-block;
    padding: 3px 7px;
    border: 1px solid #d9d9d9;
    border-radius: 3px;
    background: #f7f7f7;
    color: #555;
    font-size: 12px;
}

.event-login_success,
.event-site_login {
    color: #267a3d;
    border-color: #b9dfc2;
    background: #f2fbf4;
}

.event-login_failure {
    color: #b42318;
    border-color: #efc0bc;
    background: #fff5f4;
}

.empty-state {
    margin: 0;
    color: #777;
}

.event-user_created,
.event-user_updated,
.event-user_activated,
.event-user_sites_updated,
.event-site_created,
.event-site_updated,
.event-site_activated {
    color: #555;
    border-color: #d9d9d9;
    background: #f7f7f7;
}

.event-user_deactivated,
.event-site_deactivated {
    color: #b42318;
    border-color: #efc0bc;
    background: #fff5f4;
}