body {
    font-family: Arial, sans-serif;
    background: #f8f2f5;
    color: #2d2d2d;
    margin: 0;
    padding: 0;
}

.container {
    width: 90%;
    max-width: 760px;
    margin: 40px auto;
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.site-header {
    background: white;
    border-bottom: 1px solid #f1d4e5;
    padding: 10px 20px 10px;
    text-align: center;
}

.site-header img {
    width: min(130px, 40vw);
    height: auto;
    display: inline-block;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    background: #fff4f8;
    color: #7b3f63;
    border: 1px solid #f1d4e5;
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 13px;
    line-height: 1;
}

.social-links a svg {
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
}

.social-links a:hover {
    background: #f6dce9;
}

.home {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    box-sizing: border-box;
}

.home-panel {
    width: min(92vw, 760px);
    background: white;
    padding: 26px 30px 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.brand-logo {
    width: min(100%, 460px);
    height: auto;
    display: block;
    margin: 0 auto 16px;
}

.home-panel .social-links {
    margin-top: 0;
    margin-bottom: 14px;
}

.home-panel .brand-logo {
    margin-bottom: 18px;
}

.home-actions,
.admin-toolbar,
.page-links,
.form-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.form-actions {
    justify-content: flex-start;
    margin-bottom: 16px;
}

.page-links {
    justify-content: flex-start;
    margin-top: 18px;
}

h1, h2 {
    color: #b85c8c;
}

input,
textarea,
select {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

button {
    background: #b85c8c;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
}

a {
    color: #7b3f63;
}

.button-link {
    display: inline-block;
    text-decoration: none;
    background: #f1d4e5;
    color: #333;
    padding: 12px 18px;
    border-radius: 8px;
}

.button-link.primary {
    background: #b85c8c;
    color: white;
}

.admin-link {
    display: inline-block;
    color: #35549a;
    padding: 12px 6px;
}

.card {
    background: #fff0f6;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.guides-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.guide-card {
    background: linear-gradient(180deg, #fff5fa 0%, #ffffff 100%);
    border: 1px solid #f1d4e5;
    border-radius: 14px;
    padding: 18px;
    margin: 0;
}

.guide-card h2 {
    margin: 8px 0 10px;
    font-size: 24px;
}

.guide-card p {
    margin: 0;
    line-height: 1.6;
}

.guide-category {
    color: #7b3f63;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.emotion-checkin-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
    gap: 20px;
    align-items: start;
    margin-top: 20px;
}

.emotion-checkin-panel,
.emotion-response-card {
    background: linear-gradient(180deg, #fff9fc 0%, #ffffff 100%);
    border: 1px solid #f1d4e5;
    border-radius: 16px;
    padding: 20px;
}

.emotion-checkin-panel h2,
.emotion-response-card h2 {
    margin-top: 0;
}

.emotion-actions {
    display: flex;
    justify-content: flex-start;
}

.emotion-response-box {
    min-height: 200px;
    background: linear-gradient(180deg, #fffdfd 0%, #fff6fa 100%);
    border: 1px solid #f1d9e6;
    border-radius: 16px;
    padding: 16px;
}

.chat-message.full-width {
    width: 100%;
    box-sizing: border-box;
}

.emotion-status {
    margin-top: 12px;
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.menu a {
    text-decoration: none;
    background: #f1d4e5;
    padding: 12px;
    border-radius: 8px;
    color: #333;
}

.notice,
.alert {
    padding: 12px;
    border-radius: 8px;
    margin: 12px 0;
}

.notice {
    background: #eef7f1;
    color: #265d3b;
}

.notice:empty {
    display: none;
}

.alert {
    background: #ffe9e9;
    color: #8a2525;
}

.muted {
    color: #666;
}

.admin-container section {
    margin-top: 28px;
}

.admin-wide-container {
    max-width: 1180px;
}

.admin-home-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.admin-home-card h2 {
    margin-top: 0;
}

.admin-home-card .button-link {
    margin-top: 8px;
}

.appointment-card .button-link {
    margin-top: 8px;
}

.appointment-dates {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 12px 0;
}

.appointment-dates p {
    background: white;
    border-radius: 8px;
    margin: 0;
    padding: 10px;
}

.admin-header,
.record-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.record-head span {
    color: #666;
    white-space: nowrap;
}

.pin-form label {
    display: block;
    font-weight: bold;
    margin-bottom: 4px;
}

.form-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 12px;
}

.form-row select {
    flex: 1;
    margin: 0;
}

.form-row button {
    margin: 0;
    white-space: nowrap;
}

.button-link.small {
    padding: 10px 14px;
    font-size: 14px;
}

.appointment-status-form {
    background: white;
    padding: 12px;
    border-radius: 8px;
    margin: 12px 0;
}

.appointment-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.appointment-actions .button-link {
    flex: 1;
    min-width: 150px;
    text-align: center;
}

.profile-summary-box {
    background: white;
    border: 1px solid #f1d4e5;
    border-radius: 10px;
    padding: 12px;
    margin: 12px 0;
}

.profile-summary-box.compact {
    margin-bottom: 0;
}

.profile-summary-label {
    margin: 0 0 8px;
    color: #7b3f63;
}

.profile-summary-text {
    margin: 0;
    line-height: 1.55;
}

.table-shell {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid #f1d4e5;
    border-radius: 12px;
    overflow: hidden;
    table-layout: fixed;
}

.admin-table th,
.admin-table td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid #f5e3ed;
    vertical-align: top;
}

.admin-table thead th {
    background: #fff4f8;
    color: #7b3f63;
    font-weight: bold;
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

.admin-table .col-name {
    width: 22%;
}

.admin-table .col-email {
    width: 30%;
}

.admin-table .col-phone {
    width: 12%;
}

.admin-table .col-date {
    width: 18%;
}

.admin-table .col-actions {
    width: 18%;
}

.cell-name,
.cell-email,
.cell-phone,
.cell-date {
    overflow-wrap: anywhere;
}

.cell-name {
    font-weight: 600;
}

.cell-date {
    white-space: pre-line;
}

.table-actions-cell {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
}

.table-actions-cell .button-link {
    text-align: center;
    margin: 0;
}

.profile-table-row td {
    background: #fffafc;
}

.admin-detail-sections {
    display: grid;
    gap: 16px;
    margin-top: 24px;
}

.admin-detail-panel {
    background: linear-gradient(180deg, #fff9fc 0%, #ffffff 100%);
    border: 1px solid #f1d4e5;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 8px 22px rgba(184, 92, 140, 0.07);
}

.admin-detail-panel summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    background: #fff4f8;
    color: #7b3f63;
    font-weight: bold;
    padding: 16px 18px;
    list-style: none;
}

.admin-detail-panel summary::-webkit-details-marker {
    display: none;
}

.admin-detail-panel summary::before {
    content: "+";
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    background: white;
    border: 1px solid #f1d4e5;
    border-radius: 999px;
    color: #b85c8c;
}

.admin-detail-panel[open] summary::before {
    content: "-";
}

.admin-detail-panel summary span {
    flex: 1;
}

.admin-detail-panel summary small {
    background: white;
    border: 1px solid #f1d4e5;
    border-radius: 999px;
    color: #7b3f63;
    font-size: 13px;
    font-weight: normal;
    padding: 5px 10px;
    white-space: nowrap;
}

.admin-detail-panel[open] summary {
    border-bottom: 1px solid #f1d4e5;
}

.admin-detail-content {
    padding: 18px;
}

.user-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 18px;
}

.user-detail-grid p {
    background: white;
    border: 1px solid #f5e3ed;
    border-radius: 10px;
    margin: 0;
    padding: 12px;
    overflow-wrap: anywhere;
}

.admin-detail-meta {
    margin-bottom: 0;
    margin-top: 12px;
}

.admin-entry-item,
.admin-chat-message {
    background: white;
    border: 1px solid #f5e3ed;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 12px;
}

.admin-entry-item:last-child,
.admin-chat-message:last-child {
    margin-bottom: 0;
}

.admin-chat-log {
    max-height: 620px;
    overflow-y: auto;
}

.admin-chat-message.assistant {
    border-left: 4px solid #b85c8c;
}

.admin-chat-message.user {
    border-left: 4px solid #7b3f63;
}

.admin-chat-message p,
.admin-entry-item p {
    margin-bottom: 0;
    line-height: 1.55;
}

.notification-box {
    background: #eef7f1;
    border: 1px solid #c1e4d6;
    border-radius: 8px;
    padding: 15px;
    margin-top: 12px;
}

.notification-label {
    margin: 0 0 10px 0;
    color: #265d3b;
    font-size: 14px;
}

.notification-textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 1px solid #c1e4d6;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    background: white;
    color: #2d2d2d;
    resize: vertical;
    box-sizing: border-box;
    margin-bottom: 12px;
}

.notification-box-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.notification-box-actions .button-link {
    flex: 1;
    min-width: 140px;
    text-align: center;
}

.dashboard-shell {
    max-width: 1180px;
}

.dashboard-home-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.dashboard-home-card {
    background: linear-gradient(180deg, #fff7fb 0%, #ffffff 100%);
    border: 1px solid #f1d4e5;
    border-radius: 16px;
    padding: 22px;
}

.dashboard-home-card h2 {
    margin-top: 0;
    margin-bottom: 10px;
}

.dashboard-home-card p {
    margin: 0 0 16px;
    line-height: 1.6;
}

.dashboard-home-card .button-link {
    margin-top: 4px;
}

.chat-page-shell {
    background:
        radial-gradient(circle at top right, rgba(184, 92, 140, 0.12), transparent 28%),
        linear-gradient(180deg, #fffdfd 0%, #fff6fa 100%);
}

.chat-page-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.chat-page-header h1 {
    margin: 0 0 6px;
}

.chat-page-header p {
    margin: 0;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
    gap: 24px;
    align-items: start;
}

.dashboard-panel,
.chat-card {
    min-width: 0;
}

.chat-card {
    background: linear-gradient(180deg, #fff8fb 0%, #ffffff 100%);
    border: 1px solid #efd4e3;
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 18px 40px rgba(184, 92, 140, 0.10);
}

.chat-card-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.chat-card-header h2 {
    margin: 0 0 4px;
}

.chat-card-header p {
    margin: 0;
}

.chat-status {
    background: #eef7f1;
    color: #265d3b;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    white-space: nowrap;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: 560px;
    overflow-y: auto;
    padding: 6px 8px 6px 2px;
    margin-bottom: 16px;
}

.chat-transcript {
    background: linear-gradient(180deg, #fffdfd 0%, #fff6fa 100%);
    border: 1px solid #f1d9e6;
    border-radius: 16px;
    padding: 18px 16px;
}

.chat-message {
    width: min(88%, 100%);
    padding: 14px 16px;
    border-radius: 18px;
    line-height: 1.55;
    position: relative;
    animation: chat-slide-in 180ms ease-out;
}

.chat-message.assistant {
    align-self: flex-start;
    background: linear-gradient(180deg, #fff0f6 0%, #fff8fb 100%);
    border: 1px solid #f2d5e5;
    box-shadow: 0 10px 18px rgba(184, 92, 140, 0.08);
}

.chat-message.user {
    align-self: flex-end;
    background: linear-gradient(180deg, #b85c8c 0%, #a84f80 100%);
    border: 1px solid #a84f80;
    box-shadow: 0 10px 18px rgba(168, 79, 128, 0.18);
}

.chat-message::after {
    content: "";
    position: absolute;
    bottom: 12px;
    width: 12px;
    height: 12px;
    transform: rotate(45deg);
}

.chat-message.assistant::after {
    left: -5px;
    background: #fff3f8;
    border-left: 1px solid #f2d5e5;
    border-bottom: 1px solid #f2d5e5;
}

.chat-message.user::after {
    right: -5px;
    background: #ad5483;
    border-right: 1px solid #a84f80;
    border-top: 1px solid #a84f80;
}

.chat-message.user .chat-badge,
.chat-message.user p {
    color: white;
}

.chat-message.pending {
    opacity: 0.95;
}

.chat-message p {
    margin: 8px 0 0;
    font-size: 17px;
}

.chat-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #7b3f63;
}

.chat-typing {
    display: flex;
    gap: 6px;
    margin-top: 12px;
}

.chat-typing span {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #c27da1;
    animation: chat-bounce 1s infinite ease-in-out;
}

.chat-typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.chat-typing span:nth-child(3) {
    animation-delay: 0.3s;
}

.chat-form {
    border-top: 1px solid #f1d4e5;
    padding-top: 16px;
}

.chat-form textarea {
    min-height: 132px;
    margin-bottom: 12px;
    border: 1px solid #e8c7d8;
    background: #fffdfd;
    box-shadow: inset 0 1px 3px rgba(184, 92, 140, 0.06);
}

.voice-toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.voice-button {
    border: 1px solid #e7c7d8;
    background: white;
    color: #7b3f63;
}

.voice-button.active {
    background: #b85c8c;
    color: white;
    border-color: #b85c8c;
}

.voice-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.voice-select-row {
    margin-top: 20px;
    margin-bottom: 12px;
}

.voice-select-label {
    display: block;
    margin-bottom: 6px;
    color: #7b3f63;
    font-weight: bold;
}

.voice-select {
    margin: 0;
    border: 1px solid #e7c7d8;
    background: white;
}

.chat-form-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.chat-helper {
    margin: 0;
    font-size: 14px;
}

@keyframes chat-bounce {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 0.55;
    }

    40% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

@keyframes chat-slide-in {
    from {
        transform: translateY(8px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 560px) {
    .home-panel,
    .container {
        margin: 20px auto;
        padding: 20px;
    }

    .home-actions,
    .form-actions,
    .admin-header,
    .chat-page-header,
    .record-head,
    .appointment-dates {
        flex-direction: column;
    }

    .appointment-dates {
        display: flex;
    }

    .button-link,
    button {
        width: 100%;
        box-sizing: border-box;
        text-align: center;
    }

    .form-row {
        flex-direction: column;
        align-items: stretch;
    }

    .form-row select,
    .form-row button {
        width: 100%;
    }

    .appointment-actions {
        flex-direction: column;
    }

    .appointment-actions .button-link {
        flex: none;
        width: 100%;
    }

    .notification-box-actions {
        flex-direction: column;
    }

    .notification-box-actions .button-link {
        width: 100%;
    }

    .admin-home-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-home-grid {
        grid-template-columns: 1fr;
    }

    .user-detail-grid {
        grid-template-columns: 1fr;
    }

    .guides-grid {
        grid-template-columns: 1fr;
    }

    .emotion-checkin-shell {
        grid-template-columns: 1fr;
    }

    .voice-toolbar {
        flex-direction: column;
    }

    .voice-toolbar .button-link {
        width: 100%;
        text-align: center;
    }

    .social-links {
        gap: 8px;
    }

    .social-links a {
        width: auto;
    }
}

@media (max-width: 940px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .chat-messages {
        max-height: 420px;
    }

    .chat-message {
        width: 100%;
    }

    .table-actions-cell {
        flex-direction: column;
    }
}
