/**
 * Personal Working Style Portal — client-facing portal styles.
 *
 * These styles apply within the .si-portal wrapper only,
 * so they don't conflict with the site's existing theme.
 */

.si-portal {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: #1a1a1a;
    box-sizing: border-box;
    /* Break out of narrow theme content containers */
    width: 94vw;
    max-width: 1200px;
    margin-left: 50%;
    transform: translateX(-50%);
    position: relative;
}

.si-portal *,
.si-portal *::before,
.si-portal *::after {
    box-sizing: border-box;
}

/* ── Table wrapper for horizontal scroll on narrow screens ── */

.si-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── Header ── */

.si-portal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.si-portal__header h1 {
    font-size: 24px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

.si-portal__welcome {
    font-size: 14px;
    color: #666;
    margin: 4px 0 0 0;
}

/* ── Cards (dashboard stats) ── */

.si-portal__cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.si-card {
    background: #f5f8fa;
    border: 1px solid #dce6ec;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.si-card__number {
    display: block;
    font-size: 32px;
    font-weight: 700;
    color: #2c5f7c;
    line-height: 1.2;
}

.si-card__label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-top: 4px;
}

/* ── Actions bar ── */

.si-portal__actions {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

/* ── Section ── */

.si-portal__section {
    margin-bottom: 32px;
}

.si-portal__section h2 {
    font-size: 18px;
    font-weight: 600;
    color: #2c5f7c;
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #e8eef2;
}

/* ── Table ── */

.si-table {
    width: 100%;
    min-width: 1000px;
    border-collapse: collapse;
    font-size: 14px;
}

.si-table th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #dce6ec;
}

.si-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
    white-space: nowrap !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
}

.si-table td:nth-child(2) {
    white-space: normal !important;
}

/* Signal and report columns */
.si-table .col-signal { text-align: center; }
.si-table .col-signal-el { text-align: center; }
.si-table .col-report { text-align: center; width: 50px; }

/* Download icon link */
.si-download-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    color: #2c5f7c;
    text-decoration: none;
}
.si-download-icon:hover {
    color: #1a4a64;
}
.si-download-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.si-table tr:hover td {
    background: #fafbfc;
}

.si-table a {
    color: #2c5f7c;
    text-decoration: none;
    font-weight: 500;
}

.si-table a:hover {
    text-decoration: underline;
}

/* ── Signals ── */

.si-signal {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
}

.si-signal--green  { background: #4a8c6f; }
.si-signal--amber  { background: #c49a3c; }
.si-signal--orange { background: #c47a3c; }
.si-signal--red    { background: #b54a4a; }
.si-signal--low    { background: #999; }
.si-signal--moderate { background: #c49a3c; }
.si-signal--strong { background: #4a8c6f; }
.si-signal--deep   { background: #2c5f7c; }

/* ── Status badges ── */

.si-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.si-status--pending     { background: #f0f0f0; color: #666; }
.si-status--sent        { background: #e8eef2; color: #2c5f7c; }
.si-status--in_progress { background: #fff3cd; color: #856404; }
.si-status--scored      { background: #fff3cd; color: #856404; }
.si-status--completed   { background: #d4edda; color: #155724; }
.si-status--expired     { background: #f0f0f0; color: #999; }

/* ── Forms ── */

.si-form {
    max-width: 560px;
}

.si-form__field {
    margin-bottom: 20px;
}

.si-form__field label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 6px;
}

.si-form__field input[type="text"],
.si-form__field input[type="email"],
.si-form__field input[type="password"],
.si-form__field select {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    border: 2px solid #dce6ec;
    border-radius: 6px;
    background: #fff;
    transition: border-color 0.15s;
}

.si-form__field input:focus,
.si-form__field select:focus {
    outline: none;
    border-color: #2c5f7c;
}

.si-form__actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.si-form__error {
    background: #fdf0f0;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.si-form__success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.si-link-box {
    display: flex;
    gap: 8px;
    margin: 12px 0;
}

.si-link-box input {
    flex: 1;
    padding: 8px 12px;
    font-size: 14px;
    border: 2px solid #dce6ec;
    border-radius: 6px;
    background: #fff;
    font-family: monospace;
}

/* ── Buttons ── */

.si-btn {
    display: inline-block;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background-color 0.15s;
    line-height: 1.4;
}

.si-btn--primary {
    background: #2c5f7c;
    color: #fff;
}

.si-btn--primary:hover {
    background: #234d65;
    color: #fff;
}

.si-btn--secondary {
    background: #e8eef2;
    color: #2c5f7c;
}

.si-btn--secondary:hover {
    background: #d8e4ea;
}

.si-btn--small {
    padding: 6px 14px;
    font-size: 13px;
}

/* ── Login ── */

.si-login {
    max-width: 400px;
    margin: 40px auto;
}

.si-login h1 {
    font-size: 22px;
    margin-bottom: 8px;
}

.si-login p {
    color: #666;
    margin-bottom: 20px;
}

/* ── Utilities ── */

.si-muted {
    color: #999;
    font-size: 13px;
}

.si-portal__message {
    padding: 40px 0;
    text-align: center;
}

.si-portal__footer {
    margin-top: 40px;
    padding-top: 16px;
    border-top: 1px solid #eee;
    font-size: 14px;
}

.si-portal__footer a {
    color: #666;
}

/* ── Responsive ── */

@media (max-width: 768px) {
    .si-table {
        font-size: 13px;
    }

    .si-table th,
    .si-table td {
        padding: 8px 6px;
    }

    .si-portal__header {
        flex-direction: column;
        align-items: flex-start;
    }
}
