/* ── Tutor Orders – Public Styles ───────────────────────────────────────── */
:root {
    --to-primary:   #2563eb;
    --to-primary-h: #1d4ed8;
    --to-success:   #16a34a;
    --to-danger:    #dc2626;
    --to-warn:      #d97706;
    --to-muted:     #6b7280;
    --to-border:    #e5e7eb;
    --to-bg:        #f9fafb;
    --to-radius:    8px;
    --to-shadow:    0 1px 3px rgba(0,0,0,.1);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.to-btn {
    display:         inline-flex;
    align-items:     center;
    justify-content: center;
    gap:             6px;
    padding:         10px 20px;
    border-radius:   var(--to-radius);
    font-size:       14px;
    font-weight:     600;
    cursor:          pointer;
    text-decoration: none;
    border:          2px solid transparent;
    transition:      background .15s, border-color .15s, opacity .15s;
    line-height:     1.4;
}
.to-btn--primary  { background: var(--to-primary);  color: #fff; }
.to-btn--primary:hover { background: var(--to-primary-h); color: #fff; }
.to-btn--outline  { background: transparent; color: var(--to-primary); border-color: var(--to-primary); }
.to-btn--outline:hover { background: var(--to-primary); color: #fff; }
.to-btn--sm       { padding: 6px 12px; font-size: 12px; }
.to-btn--full     { width: 100%; margin-top: 16px; }
.to-btn:disabled  { opacity: .55; cursor: not-allowed; }

/* ── Notice / Alert ──────────────────────────────────────────────────────── */
.to-notice        { padding: 12px 16px; border-radius: var(--to-radius); margin-bottom: 16px; font-size: 14px; }
.to-notice--success { background: #dcfce7; color: #166534; }
.to-notice--error   { background: #fee2e2; color: #991b1b; }

/* ── Calculator ──────────────────────────────────────────────────────────── */
.to-calculator {
    background:    #fff;
    border:        1px solid var(--to-border);
    border-radius: 12px;
    padding:       24px;
    max-width:     380px;
    box-shadow:    var(--to-shadow);
}
.to-calc__title    { margin: 0 0 20px; font-size: 17px; font-weight: 700; }
.to-calc__row      { margin-bottom: 14px; }
.to-calc__row label{ display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: #374151; }
.to-calc__row select,
.to-calc__row input[type="number"],
.to-calc__row input[type="text"] {
    width:         100%;
    padding:       8px 10px;
    border:        1px solid var(--to-border);
    border-radius: 6px;
    font-size:     14px;
    box-sizing:    border-box;
}
.to-calc__pages-wrap,
.to-calc__discount-wrap { display: flex; gap: 8px; }
.to-calc__pages-wrap #calc-pages { width: 80px; flex-shrink: 0; }
.to-calc__pages-wrap #calc-spacing { flex: 1; }
.to-calc__discount-wrap input { flex: 1; }
.to-optional       { font-size: 11px; color: var(--to-muted); font-weight: 400; }
.to-calc__result   { background: var(--to-bg); border-radius: 8px; padding: 14px; margin: 16px 0 0; }
.to-breakdown-item { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; color: #374151; }
.to-breakdown-item--discount { color: var(--to-success); font-weight: 600; }
.to-calc__total    { border-top: 1px solid var(--to-border); margin-top: 10px; padding-top: 10px; display: flex; justify-content: space-between; font-size: 16px; font-weight: 700; }
.to-calc__discount-msg { font-size: 12px; display: block; margin-top: 4px; }
.to-calc__discount-msg.success { color: var(--to-success); }
.to-calc__discount-msg.error   { color: var(--to-danger); }

/* ── Order Form ──────────────────────────────────────────────────────────── */
.to-order-form-wrap { max-width: 740px; }
.to-order-form-wrap h2 { margin-bottom: 24px; }
.to-fieldset { border: 1px solid var(--to-border); border-radius: var(--to-radius); padding: 20px 24px; margin-bottom: 24px; }
.to-fieldset legend { font-weight: 700; font-size: 14px; padding: 0 8px; color: #111827; }
.to-field { margin-bottom: 16px; }
.to-field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: #374151; }
.to-field input[type="text"],
.to-field input[type="number"],
.to-field select,
.to-field textarea {
    width: 100%; padding: 9px 11px; border: 1px solid var(--to-border);
    border-radius: 6px; font-size: 14px; box-sizing: border-box;
    transition: border-color .15s;
}
.to-field input:focus, .to-field select:focus, .to-field textarea:focus {
    outline: none; border-color: var(--to-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.to-field--half  { display: inline-block; width: calc(50% - 8px); margin-right: 16px; }
.to-field--half:last-of-type { margin-right: 0; }
.to-field--third { display: inline-block; width: calc(33.33% - 11px); margin-right: 16px; }
.to-field--third:last-of-type { margin-right: 0; }
.to-wordcount { font-size: 11px; color: var(--to-muted); display: block; margin-top: 3px; }
.req { color: var(--to-danger); }

.to-inline-input { display: flex; gap: 8px; }
.to-inline-input input { flex: 1; }
.to-discount-msg { font-size: 12px; display: block; margin-top: 4px; }
.to-discount-msg.success { color: var(--to-success); }
.to-discount-msg.error   { color: var(--to-danger); }

.to-price-summary {
    background: var(--to-bg); border: 1px solid var(--to-border);
    border-radius: var(--to-radius); padding: 16px 20px;
}
.to-price-summary__row {
    display: flex; justify-content: space-between;
    padding: 6px 0; font-size: 14px; border-bottom: 1px solid var(--to-border);
}
.to-price-summary__row:last-child { border-bottom: none; }
.to-price-summary__discount strong { color: var(--to-success); }
.to-price-summary__total { font-size: 17px; font-weight: 700; }

/* ── Login notice ────────────────────────────────────────────────────────── */
.to-login-notice { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: var(--to-radius); padding: 28px; text-align: center; max-width: 460px; }
.to-login-notice p { margin: 0 0 12px; }
.to-login-notice__sub { font-size: 13px; color: var(--to-muted); }
.to-login-notice__btns { display: flex; gap: 12px; justify-content: center; margin-top: 16px; }

/* ── Dashboard ───────────────────────────────────────────────────────────── */
.to-dashboard__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.to-dashboard__header h2 { margin: 0; font-size: 20px; }
.to-dashboard__header-actions { display: flex; gap: 10px; }

.to-status-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.to-tab { padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 600; text-decoration: none; color: var(--to-muted); border: 1px solid var(--to-border); background: #fff; transition: all .15s; }
.to-tab:hover, .to-tab.active { background: var(--to-primary); color: #fff; border-color: var(--to-primary); }

.to-orders-table-wrap { overflow-x: auto; }
.to-orders-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.to-orders-table th, .to-orders-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--to-border); }
.to-orders-table th { background: var(--to-bg); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--to-muted); }
.to-orders-table tr:hover td { background: #f8faff; }

.to-empty { text-align: center; padding: 48px 24px; color: var(--to-muted); }
.to-empty p { font-size: 16px; margin-bottom: 16px; }

/* ── Status badges ───────────────────────────────────────────────────────── */
.to-status {
    display: inline-block; padding: 3px 10px; border-radius: 12px;
    font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.to-status--lg { font-size: 13px; padding: 5px 14px; }
.to-status--pending     { background: #fef3c7; color: #92400e; }
.to-status--in_progress { background: #dbeafe; color: #1e40af; }
.to-status--delivered   { background: #d1fae5; color: #065f46; }
.to-status--approved    { background: #dcfce7; color: #166534; }
.to-status--revision    { background: #ede9fe; color: #5b21b6; }
.to-status--cancelled   { background: #fee2e2; color: #991b1b; }
.to-status--disputed    { background: #fff7ed; color: #c2410c; }

/* ── Order Detail ────────────────────────────────────────────────────────── */
.to-back-link { font-size: 13px; color: var(--to-primary); text-decoration: none; display: inline-block; margin-bottom: 16px; }
.to-back-link:hover { text-decoration: underline; }

.to-order-detail__header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 20px; gap: 12px; flex-wrap: wrap;
}
.to-order-detail__header h3 { margin: 0 0 4px; font-size: 18px; }
.to-uid { font-size: 12px; color: var(--to-muted); background: var(--to-bg); padding: 2px 8px; border-radius: 4px; }

.to-order-detail__meta {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px; background: var(--to-bg); border-radius: var(--to-radius);
    padding: 16px; margin-bottom: 20px; font-size: 13px;
}
.to-order-detail__meta div strong { display: inline; color: var(--to-muted); font-weight: 600; }

.to-order-detail__instructions { font-size: 14px; margin-bottom: 16px; }
.to-order-detail__instructions p { background: var(--to-bg); padding: 12px; border-radius: 6px; white-space: pre-wrap; }

.to-order-detail__files { margin-bottom: 16px; font-size: 13px; }
.to-file-link { display: inline-block; margin: 4px 8px 4px 0; color: var(--to-primary); text-decoration: none; }
.to-file-link:hover { text-decoration: underline; }

.to-order-actions, .to-admin-status-change, .to-admin-extend {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    background: var(--to-bg); padding: 14px 16px; border-radius: var(--to-radius);
    margin-bottom: 16px; font-size: 13px;
}
.to-order-actions strong, .to-admin-status-change strong, .to-admin-extend strong { color: #374151; }
.to-admin-status-change select, .to-admin-extend select { padding: 7px 10px; border: 1px solid var(--to-border); border-radius: 6px; font-size: 13px; }

/* ── Messaging ───────────────────────────────────────────────────────────── */
.to-messaging { margin-top: 24px; }
.to-messaging h4 { font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.to-unread-badge { background: var(--to-danger); color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 7px; }

.to-messages {
    border: 1px solid var(--to-border); border-radius: var(--to-radius);
    padding: 16px; min-height: 200px; max-height: 420px;
    overflow-y: auto; background: var(--to-bg); margin-bottom: 12px;
    display: flex; flex-direction: column; gap: 12px;
}
.to-loading { color: var(--to-muted); font-size: 13px; text-align: center; }

.to-msg { max-width: 80%; }
.to-msg--system { max-width: 100%; align-self: center; }
.to-msg--mine   { align-self: flex-end; }
.to-msg--theirs { align-self: flex-start; }

.to-msg__body {
    padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.5;
    word-break: break-word;
}
.to-msg--mine .to-msg__body   { background: var(--to-primary); color: #fff; border-bottom-right-radius: 4px; }
.to-msg--theirs .to-msg__body { background: #fff; border: 1px solid var(--to-border); border-bottom-left-radius: 4px; }
.to-msg--system .to-msg__body { background: #fffbeb; border: 1px solid #fef08a; color: #713f12; text-align: center; font-size: 13px; border-radius: 8px; }

.to-msg__meta  { font-size: 11px; color: var(--to-muted); margin-top: 3px; }
.to-msg--mine .to-msg__meta  { text-align: right; }
.to-msg-attach { display: inline-block; font-size: 12px; margin-top: 4px; color: var(--to-primary); text-decoration: none; }
.to-msg--mine .to-msg-attach { color: rgba(255,255,255,.9); }

.to-msg-form textarea {
    width: 100%; padding: 10px; border: 1px solid var(--to-border);
    border-radius: var(--to-radius); font-size: 14px; resize: vertical; box-sizing: border-box;
}
.to-msg-form__footer { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.to-file-label { font-size: 12px; color: var(--to-primary); cursor: pointer; font-weight: 600; }
.to-file-label input[type="file"] { display: none; }
.to-msg-file-name { font-size: 12px; color: var(--to-muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.to-msg-form__footer .to-btn { margin-left: auto; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .to-field--half, .to-field--third { display: block; width: 100%; margin-right: 0; }
    .to-order-detail__header { flex-direction: column; }
    .to-msg { max-width: 95%; }
}
