.tci-app {
    --yellow: #f7d800;
    --orange: #ef6c00;
    --ink: #171717;
    --muted: #666;
    --line: #d9d9d9;
    --surface: #fff;
    max-width: 1180px;
    margin: 24px auto;
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
}
.tci-app * { box-sizing: border-box; }
.tci-header {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-end;
    padding: 26px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--yellow), #ffef72);
    box-shadow: 0 12px 30px rgba(0,0,0,.10);
    margin-bottom: 22px;
}
.tci-kicker { font-size: 13px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.tci-header h1 { margin: 3px 0 6px; font-size: clamp(30px, 5vw, 52px); line-height: 1; }
.tci-header p { margin: 0; color: #3f3a00; }
.tci-rating-key { display: grid; grid-template-columns: repeat(2, auto); gap: 8px 14px; min-width: 210px; }
.tci-rating-key span { background: rgba(255,255,255,.68); border-radius: 999px; padding: 7px 11px; font-size: 13px; }
.tci-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 22px;
    margin: 18px 0;
    box-shadow: 0 8px 22px rgba(0,0,0,.05);
}
.tci-card h2 { margin: 0 0 16px; font-size: 22px; }
.tci-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tci-grid label { display: grid; gap: 7px; font-weight: 700; font-size: 14px; }
.tci-app input[type="text"], .tci-app input[type="number"], .tci-app input[type="date"], .tci-app input[type="time"], .tci-app textarea {
    width: 100%;
    min-height: 48px;
    border: 1px solid #bdbdbd;
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    background: #fff;
    color: #111;
}
.tci-app textarea { resize: vertical; }
.tci-app input:focus, .tci-app textarea:focus { outline: 3px solid rgba(247,216,0,.35); border-color: #8a7900; }
.tci-section-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tci-fill-section, .tci-secondary {
    border: 1px solid #aaa;
    background: #f6f6f6;
    color: #222;
    padding: 10px 13px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
}
.tci-table { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.tci-row { display: grid; grid-template-columns: minmax(240px, 1.5fr) minmax(220px, .7fr) minmax(220px, 1fr); border-top: 1px solid var(--line); }
.tci-row:first-child { border-top: 0; }
.tci-row > div { padding: 10px; display: flex; align-items: center; }
.tci-head { background: #171717; color: #fff; font-weight: 800; }
.tci-item { font-weight: 700; line-height: 1.35; }
.tci-options { display: grid !important; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.tci-rating input { position: absolute; opacity: 0; pointer-events: none; }
.tci-rating span {
    display: grid;
    place-items: center;
    min-height: 44px;
    border: 2px solid #bdbdbd;
    border-radius: 10px;
    font-weight: 900;
    cursor: pointer;
    user-select: none;
}
.tci-rating input:checked + span { background: var(--yellow); border-color: #8f7c00; color: #111; box-shadow: inset 0 0 0 2px #fff; }
.tci-help { margin-top: -8px; color: var(--muted); }
.tci-signature-wrap { border: 2px dashed #999; border-radius: 12px; background: #fff; overflow: hidden; touch-action: none; }
#tci-signature { display: block; width: 100%; height: 210px; touch-action: none; }
.tci-submit-bar {
    position: sticky;
    bottom: 10px;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    background: rgba(24,24,24,.96);
    color: #fff;
    border-radius: 16px;
    padding: 14px;
    box-shadow: 0 12px 32px rgba(0,0,0,.25);
}
.tci-submit {
    border: 0;
    background: var(--yellow);
    color: #111;
    padding: 15px 22px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 900;
    cursor: pointer;
    white-space: nowrap;
}
.tci-submit:disabled { opacity: .55; cursor: wait; }
.tci-success { color: #a8f0ad; font-weight: 700; }
.tci-error { color: #ffb2b2; font-weight: 700; }
.tci-working { color: #ffe96e; font-weight: 700; }

@media (max-width: 820px) {
    .tci-app { margin: 10px; }
    .tci-header { align-items: flex-start; flex-direction: column; padding: 20px; }
    .tci-grid { grid-template-columns: 1fr; }
    .tci-row { grid-template-columns: 1fr; }
    .tci-head { display: none; }
    .tci-row > div { border-top: 0; }
    .tci-row:not(.tci-head) { padding: 8px; }
    .tci-options { width: 100%; }
    .tci-section-title { align-items: flex-start; flex-direction: column; }
    .tci-submit-bar { align-items: stretch; flex-direction: column; }
    .tci-submit { width: 100%; }
}


/* v1.1.0 save/download/email enhancements */
.tci-email-field {
    grid-column: span 2;
}
.tci-submit-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.tci-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 12px 18px;
    border: 2px solid #111;
    border-radius: 10px;
    background: #fff;
    color: #111 !important;
    font-weight: 800;
    text-decoration: none !important;
}
.tci-download:hover, .tci-download:focus {
    background: #f4f4f4;
}
.tci-download[hidden] {
    display: none !important;
}
@media (max-width: 700px) {
    .tci-email-field { grid-column: span 1; }
    .tci-submit-actions { width: 100%; }
    .tci-submit-actions > * { width: 100%; }
}


/* v1.2.1 fillable temperature readings */
.tci-item-label {
    font-weight: 700;
}
.tci-temperature-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}
.tci-temperature-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 112px;
    font-size: 12px;
    font-weight: 800;
}
.tci-temperature-input-wrap {
    display: flex;
    align-items: center;
    overflow: hidden;
    border: 2px solid #bbb;
    border-radius: 9px;
    background: #fff;
}
.tci-temperature-input-wrap:focus-within {
    border-color: #111;
    box-shadow: 0 0 0 3px rgba(250, 221, 0, .45);
}
.tci-temp-input {
    width: 76px;
    min-height: 44px;
    margin: 0 !important;
    padding: 8px 7px !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    font-size: 18px !important;
    font-weight: 800;
    text-align: center;
}
.tci-degree {
    align-self: stretch;
    display: inline-flex;
    align-items: center;
    padding: 0 9px;
    background: #f0f0f0;
    border-left: 1px solid #ccc;
    font-weight: 900;
}
@media (max-width: 820px) {
    .tci-temperature-field { flex: 1 1 105px; }
    .tci-temp-input { width: 100%; }
}

/* v1.2.2 clear/new inspection and autosave status */
.tci-clear-form,
.tci-new-inspection {
    min-height: 48px;
    border: 2px solid #fff;
    background: transparent;
    color: #fff;
}
.tci-clear-form:hover,
.tci-clear-form:focus,
.tci-new-inspection:hover,
.tci-new-inspection:focus {
    background: #fff;
    color: #111;
}
.tci-draft { color: #9ed8ff; font-weight: 700; }
.tci-submit-actions [hidden] { display: none !important; }

.tci-store-field { grid-column: span 2; }
.tci-store-field .tci-field-help { display:block; margin-top:6px; font-weight:400; }
.tci-score-card { display:grid; grid-template-columns:minmax(240px,.8fr) minmax(280px,1.2fr); gap:24px; align-items:center; border-left:6px solid #fadd00; }
.tci-score-card h2 { margin:.2rem 0; font-size:2rem; }
.tci-score-card h2 small { display:inline-block; font-size:1rem; font-weight:700; margin-left:8px; }
.tci-live-issues { background:#f6f7f7; padding:14px; border-radius:8px; line-height:1.5; }
@media (max-width: 720px) { .tci-store-field { grid-column:auto; } .tci-score-card { grid-template-columns:1fr; } }


/* v1.4.1 refined corrective action workflow */
.tci-comment-cell {
    align-items: stretch !important;
}
.tci-corrective-wrap {
    grid-column: 1 / -1;
    display: block;
    margin: 0 12px 14px;
    padding: 16px;
    border: 1px solid #efb0aa;
    border-left: 5px solid #b42318;
    border-radius: 14px;
    background: linear-gradient(135deg, #fff8f7 0%, #fff 75%);
    box-shadow: 0 8px 22px rgba(180, 35, 24, .08);
}
.tci-corrective-wrap[hidden] { display: none !important; }
.tci-corrective-heading {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
}
.tci-corrective-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #b42318;
    color: #fff;
    font-size: 22px;
    font-weight: 900;
    line-height: 1;
}
.tci-corrective-heading strong {
    display: block;
    color: #8a1c13;
    font-size: 16px;
    line-height: 1.2;
}
.tci-corrective-heading div > span {
    display: block;
    margin-top: 3px;
    color: #6f3b36;
    font-size: 13px;
    line-height: 1.4;
}
.tci-corrective-rating {
    display: inline-grid;
    place-items: center;
    min-width: 42px;
    height: 36px;
    padding: 0 12px;
    border-radius: 999px;
    background: #b42318;
    color: #fff;
    font-size: 14px;
    font-weight: 900;
}
.tci-corrective-rating[data-rating="F"] { background: #b05c00; }
.tci-corrective-label {
    display: block;
    margin-bottom: 7px;
    color: #43201d;
    font-size: 13px;
    font-weight: 800;
}
.tci-corrective-wrap .tci-corrective-action {
    width: 100%;
    min-height: 104px;
    margin: 0;
    padding: 12px 14px;
    border: 1px solid #d5a29d;
    border-radius: 10px;
    background: #fff;
    line-height: 1.45;
}
.tci-corrective-wrap .tci-corrective-action:focus {
    border-color: #b42318;
    outline: 3px solid rgba(180, 35, 24, .14);
}
@media (max-width: 820px) {
    .tci-corrective-wrap { margin: 2px 8px 12px; padding: 14px; }
    .tci-corrective-heading { grid-template-columns: 34px minmax(0, 1fr) auto; gap: 9px; }
    .tci-corrective-icon { width: 34px; height: 34px; }
    .tci-corrective-heading div > span { font-size: 12px; }
}
.tci-signoff-card + .tci-signoff-card { margin-top: 18px; }
.tci-acknowledgement {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    margin: 12px 0;
    border-radius: 10px;
    background: #f5f5f5;
    font-weight: 700;
}
.tci-acknowledgement input {
    width: 22px;
    height: 22px;
    margin-top: 1px;
    flex: 0 0 auto;
}
#tci-manager-signature {
    display: block;
    width: 100%;
    height: 210px;
    touch-action: none;
}


/* v1.4.5 authenticated evaluation portal */
.tci-login-app {
    max-width: 620px;
    margin: 48px auto;
    padding: 18px;
}

.tci-login-card {
    overflow: hidden;
    border: 1px solid rgba(0,0,0,.09);
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 22px 65px rgba(0,0,0,.14);
}

.tci-login-brand {
    padding: 34px 34px 28px;
    background: linear-gradient(135deg, #111 0%, #2b2b2b 100%);
    color: #fff;
}

.tci-login-brand h1 {
    margin: 6px 0 10px;
    color: #fff;
    font-size: clamp(2rem, 6vw, 3.2rem);
    line-height: 1;
}

.tci-login-brand p {
    max-width: 520px;
    margin: 0;
    color: rgba(255,255,255,.78);
    line-height: 1.55;
}

.tci-login-form-wrap {
    padding: 30px 34px 24px;
}

#tci-login-form p {
    margin: 0 0 18px;
}

#tci-login-form label {
    display: block;
    margin-bottom: 7px;
    color: #222;
    font-weight: 800;
}

#tci-login-form input[type="text"],
#tci-login-form input[type="password"] {
    box-sizing: border-box;
    width: 100%;
    min-height: 52px;
    padding: 10px 14px;
    border: 2px solid #d6d6d6;
    border-radius: 12px;
    background: #fff;
    font-size: 17px;
}

#tci-login-form input[type="text"]:focus,
#tci-login-form input[type="password"]:focus {
    border-color: #d3b800;
    outline: 4px solid rgba(250,221,0,.22);
}

#tci-login-form .login-remember label {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 700;
}

#tci-login-form .login-remember input {
    width: 21px;
    height: 21px;
    margin: 0;
}

#tci-login-form .button-primary {
    width: 100%;
    min-height: 54px;
    border: 0;
    border-radius: 12px;
    background: #fadd00;
    color: #111;
    font-size: 17px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(204,177,0,.24);
}

#tci-login-form .button-primary:hover {
    filter: brightness(.96);
    transform: translateY(-1px);
}

.tci-login-links {
    text-align: center;
}

.tci-login-links a {
    color: #4b4b4b;
    font-weight: 700;
}

.tci-login-security {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    padding: 16px 24px;
    border-top: 1px solid #ececec;
    background: #f7f7f7;
    color: #555;
    font-size: 13px;
    text-align: center;
}

.tci-login-security strong {
    color: #222;
}

.tci-user-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 0 0 18px;
    padding: 11px 14px;
    border: 1px solid #d9d9d9;
    border-radius: 12px;
    background: #fff;
    color: #333;
    font-size: 14px;
}

.tci-user-bar > div {
    display: flex;
    align-items: center;
    gap: 7px;
}

.tci-user-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #1b9b50;
    box-shadow: 0 0 0 4px rgba(27,155,80,.14);
}

.tci-user-bar a {
    color: #8a1c13;
    font-weight: 800;
    text-decoration: none;
}

@media (max-width: 620px) {
    .tci-login-app { margin: 18px auto; padding: 10px; }
    .tci-login-brand,
    .tci-login-form-wrap { padding-left: 22px; padding-right: 22px; }
    .tci-user-bar { align-items: flex-start; flex-direction: column; }
}
