/* =========================================================
   TWP INVOICE MAKER PRO — TEMPLATES
   Professional module styling
   Sidebar intentionally matches Dashboard / Invoices /
   Create Invoice / Customers navigation.
   ========================================================= */

.twpim-templates-shell,
.twpim-templates-shell * {
    box-sizing: border-box;
}

.twpim-templates-shell {
    --twpim-navy: #0b203d;
    --twpim-navy-2: #102947;
    --twpim-blue: #216be8;
    --twpim-blue-dark: #155dcc;
    --twpim-text: #102b4e;
    --twpim-muted: #7186a3;
    --twpim-border: #dfe8f3;
    --twpim-bg: #f5f8fc;
    --twpim-white: #ffffff;
    --twpim-shadow: 0 12px 30px rgba(18, 53, 94, .08);

    display: flex;
    width: 100%;
    min-height: 760px;
    background: var(--twpim-bg);
    color: var(--twpim-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    line-height: 1.5;
}

/* ---------------------------------------------------------
   Sidebar — same visual treatment as the established pages
   --------------------------------------------------------- */

.twpim-templates-shell .twpim-sidebar {
    flex: 0 0 280px;
    width: 280px;
    min-width: 280px;
    background: var(--twpim-navy);
    color: #fff;
    align-self: stretch;
}

.twpim-templates-shell .twpim-brand {
    min-height: 112px;
    padding: 32px 26px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid rgba(255,255,255,.09);
}

.twpim-templates-shell .twpim-brand-mark {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 13px;
    background: var(--twpim-blue);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -.3px;
}

.twpim-templates-shell .twpim-brand-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.twpim-templates-shell .twpim-brand-copy strong {
    color: #fff;
    font-size: 15px;
    line-height: 1.2;
    font-weight: 700;
    white-space: nowrap;
}

.twpim-templates-shell .twpim-brand-copy span {
    margin-top: 7px;
    color: #9eb1ca;
    font-size: 12px;
    line-height: 1.2;
    font-weight: 400;
    white-space: nowrap;
}

.twpim-templates-shell .twpim-nav {
    padding: 18px 14px 28px;
}

.twpim-templates-shell .twpim-nav-item {
    width: 100%;
    min-height: 46px;
    margin: 3px 0;
    padding: 0 18px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    border-radius: 10px;
    color: #9fb2cb;
    background: transparent;
    text-decoration: none;
    text-align: left;
    font-size: 14px;
    line-height: 1.2;
    font-weight: 400;
    white-space: nowrap;
    transition: background .18s ease, color .18s ease;
}

.twpim-templates-shell .twpim-nav-item:hover {
    color: #fff;
    background: rgba(255,255,255,.055);
}

.twpim-templates-shell .twpim-nav-item.is-active {
    color: #fff;
    background: var(--twpim-blue);
    box-shadow: 0 8px 18px rgba(33,107,232,.20);
}

.twpim-templates-shell .twpim-nav-icon {
    width: 18px;
    min-width: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    font-size: 13px;
    line-height: 1;
    font-weight: 400;
}

.twpim-templates-shell .twpim-nav-item > span:last-child {
    display: block;
    min-width: 0;
    text-align: left;
    font-weight: 400;
    white-space: nowrap;
}

/* ---------------------------------------------------------
   Main workspace / top bar
   --------------------------------------------------------- */

.twpim-templates-shell .twpim-workspace {
    flex: 1 1 auto;
    min-width: 0;
    background: var(--twpim-bg);
}

.twpim-templates-shell .twpim-topbar {
    min-height: 88px;
    padding: 18px 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    background: #fff;
    border-bottom: 1px solid var(--twpim-border);
}

.twpim-templates-shell .twpim-top-search {
    width: min(540px, 60%);
}

.twpim-templates-shell .twpim-top-search input {
    width: 100%;
    height: 50px;
    padding: 0 18px 0 20px;
    border: 1px solid var(--twpim-border);
    border-radius: 10px;
    background: #fff;
    color: var(--twpim-text);
    font-size: 14px;
    font-weight: 400;
    outline: none;
}

.twpim-templates-shell .twpim-top-search input:focus {
    border-color: #9fc1f7;
    box-shadow: 0 0 0 3px rgba(33,107,232,.08);
}

.twpim-templates-shell .twpim-top-user {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 220px;
    justify-content: flex-end;
}

.twpim-templates-shell .twpim-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #edf4ff;
    color: var(--twpim-blue);
    font-weight: 700;
}

.twpim-templates-shell .twpim-user-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.twpim-templates-shell .twpim-user-copy strong {
    font-size: 14px;
    line-height: 1.25;
    font-weight: 600;
    color: var(--twpim-text);
}

.twpim-templates-shell .twpim-user-copy span {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.25;
    font-weight: 400;
    color: var(--twpim-muted);
}

/* ---------------------------------------------------------
   Main template area
   --------------------------------------------------------- */

.twpim-templates-shell .twpim-template-main {
    padding: 40px 40px 70px;
    max-width: 1500px;
    margin: 0 auto;
}

.twpim-templates-shell .twpim-template-heading {
    margin-bottom: 30px;
}

.twpim-templates-shell .twpim-eyebrow,
.twpim-templates-shell .twpim-modal-kicker {
    display: block;
    margin-bottom: 7px;
    color: var(--twpim-blue);
    font-size: 12px;
    line-height: 1.2;
    letter-spacing: 1.8px;
    font-weight: 700;
}

.twpim-templates-shell .twpim-template-heading h1 {
    margin: 0;
    color: var(--twpim-text);
    font-size: clamp(30px, 3vw, 42px);
    line-height: 1.08;
    letter-spacing: -1.2px;
    font-weight: 700;
}

.twpim-templates-shell .twpim-template-heading p {
    margin: 10px 0 0;
    color: var(--twpim-muted);
    font-size: 16px;
    font-weight: 400;
}

/* ---------------------------------------------------------
   Sections
   --------------------------------------------------------- */

.twpim-templates-shell .twpim-template-section {
    margin-top: 28px;
    padding: 28px;
    background: #fff;
    border: 1px solid var(--twpim-border);
    border-radius: 16px;
    box-shadow: 0 4px 18px rgba(18,53,94,.035);
}

.twpim-templates-shell .twpim-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.twpim-templates-shell .twpim-section-heading h2 {
    margin: 0;
    color: var(--twpim-text);
    font-size: 21px;
    line-height: 1.25;
    font-weight: 650;
}

.twpim-templates-shell .twpim-section-heading p {
    margin: 6px 0 0;
    color: var(--twpim-muted);
    font-size: 13px;
    font-weight: 400;
}

/* ---------------------------------------------------------
   Buttons
   --------------------------------------------------------- */

.twpim-templates-shell .twpim-btn {
    min-height: 46px;
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1;
    font-weight: 600;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.twpim-templates-shell .twpim-btn:hover {
    transform: translateY(-1px);
}

.twpim-templates-shell .twpim-btn-primary {
    background: var(--twpim-blue);
    color: #fff;
    box-shadow: 0 8px 18px rgba(33,107,232,.16);
}

.twpim-templates-shell .twpim-btn-primary:hover {
    background: var(--twpim-blue-dark);
}

.twpim-templates-shell .twpim-btn-secondary {
    background: #fff;
    color: var(--twpim-text);
    border-color: var(--twpim-border);
}

.twpim-templates-shell .twpim-btn-secondary:hover {
    border-color: #c8d7e9;
    background: #f8fbff;
}

/* ---------------------------------------------------------
   Template cards
   --------------------------------------------------------- */

.twpim-templates-shell .twpim-template-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.twpim-templates-shell .twpim-template-card {
    overflow: hidden;
    border: 1px solid var(--twpim-border);
    border-radius: 14px;
    background: #fff;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.twpim-templates-shell .twpim-template-card:hover {
    transform: translateY(-2px);
    border-color: #cdddf1;
    box-shadow: var(--twpim-shadow);
}

.twpim-templates-shell .twpim-template-preview {
    min-height: 250px;
    padding: 20px;
    background: #f4f7fb;
    border-bottom: 1px solid var(--twpim-border);
}

.twpim-templates-shell .twpim-mini-invoice {
    width: 100%;
    min-height: 210px;
    padding: 17px;
    background: #fff;
    border: 1px solid #e4eaf2;
    box-shadow: 0 6px 16px rgba(20,50,90,.07);
}

.twpim-templates-shell .twpim-sample-header {
    min-height: 32px;
    padding-bottom: 10px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 2px solid #dfe7f1;
}

.twpim-templates-shell .twpim-sample-header strong {
    font-size: 11px;
    font-weight: 700;
    color: var(--twpim-text);
}

.twpim-templates-shell .twpim-sample-header span {
    font-size: 8px;
    color: var(--twpim-muted);
    font-weight: 400;
}

.twpim-templates-shell .twpim-mini-head {
    height: 7px;
    width: 42%;
    margin: 14px 0 8px;
    border-radius: 4px;
    background: #dfe7f1;
}

.twpim-templates-shell .twpim-mini-lines {
    display: grid;
    gap: 6px;
}

.twpim-templates-shell .twpim-mini-lines span {
    display: block;
    height: 5px;
    border-radius: 3px;
    background: #edf1f6;
}

.twpim-templates-shell .twpim-mini-lines span:nth-child(2) { width: 88%; }
.twpim-templates-shell .twpim-mini-lines span:nth-child(3) { width: 74%; }
.twpim-templates-shell .twpim-mini-lines span:nth-child(4) { width: 91%; }

.twpim-templates-shell .twpim-mini-total {
    width: 48%;
    height: 18px;
    margin: 18px 0 0 auto;
    border-radius: 4px;
    background: #dce8f9;
}

.twpim-templates-shell .twpim-template-card-body {
    padding: 18px 19px 19px;
}

.twpim-templates-shell .twpim-template-card-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.twpim-templates-shell .twpim-template-card-title h3 {
    margin: 0;
    color: var(--twpim-text);
    font-size: 16px;
    line-height: 1.3;
    font-weight: 600;
}

.twpim-templates-shell .twpim-template-meta {
    margin-top: 6px;
    color: var(--twpim-muted);
    font-size: 12px;
    font-weight: 400;
}

.twpim-templates-shell .twpim-template-badge {
    display: inline-flex;
    align-items: center;
    min-height: 25px;
    padding: 0 9px;
    border-radius: 999px;
    background: #e9f1ff;
    color: var(--twpim-blue);
    font-size: 11px;
    line-height: 1;
    font-weight: 600;
    white-space: nowrap;
}

.twpim-templates-shell .twpim-template-actions {
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* ---------------------------------------------------------
   Letterhead
   --------------------------------------------------------- */

.twpim-templates-shell .twpim-letterhead-info {
    margin-bottom: 22px;
    padding: 15px 17px;
    display: flex;
    align-items: flex-start;
    gap: 13px;
    border: 1px solid #dce9fb;
    border-radius: 11px;
    background: #f5f9ff;
}

.twpim-templates-shell .twpim-info-icon {
    width: 30px;
    height: 30px;
    min-width: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e1edff;
    color: var(--twpim-blue);
    font-size: 13px;
    font-weight: 700;
}

.twpim-templates-shell .twpim-letterhead-info strong {
    color: var(--twpim-text);
    font-size: 13px;
    font-weight: 600;
}

.twpim-templates-shell .twpim-letterhead-info p {
    margin: 3px 0 0;
    color: var(--twpim-muted);
    font-size: 12px;
    font-weight: 400;
}

.twpim-templates-shell .twpim-letterhead-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.twpim-templates-shell .twpim-letterhead-card {
    overflow: hidden;
    border: 1px solid var(--twpim-border);
    border-radius: 14px;
    background: #fff;
}

.twpim-templates-shell .twpim-letterhead-preview {
    position: relative;
    min-height: 260px;
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f7fa;
    border-bottom: 1px solid var(--twpim-border);
}

.twpim-templates-shell .twpim-letterhead-preview img {
    display: block;
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    background: #fff;
    box-shadow: 0 6px 15px rgba(15,40,70,.08);
}

.twpim-templates-shell .twpim-letterhead-preview > .twpim-template-badge {
    position: absolute;
    top: 13px;
    right: 13px;
}

.twpim-templates-shell .twpim-letterhead-body {
    padding: 17px 18px;
}

.twpim-templates-shell .twpim-letterhead-body h3 {
    margin: 0;
    color: var(--twpim-text);
    font-size: 15px;
    line-height: 1.3;
    font-weight: 600;
}

.twpim-templates-shell .twpim-letterhead-body p {
    margin: 5px 0 0;
    color: var(--twpim-muted);
    font-size: 12px;
    font-weight: 400;
}

.twpim-templates-shell .twpim-letterhead-actions {
    margin-top: 15px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* Empty state */

.twpim-templates-shell .twpim-empty-letterhead {
    grid-column: 1 / -1;
    padding: 45px 24px;
    text-align: center;
    border: 1px dashed #cfdbea;
    border-radius: 14px;
    background: #fbfcfe;
}

.twpim-templates-shell .twpim-empty-icon {
    width: 50px;
    height: 50px;
    margin: 0 auto 13px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #edf4ff;
    color: var(--twpim-blue);
    font-size: 21px;
}

.twpim-templates-shell .twpim-empty-letterhead h3 {
    margin: 0;
    color: var(--twpim-text);
    font-size: 17px;
    font-weight: 600;
}

.twpim-templates-shell .twpim-empty-letterhead p {
    max-width: 500px;
    margin: 7px auto 18px;
    color: var(--twpim-muted);
    font-size: 13px;
    font-weight: 400;
}

/* ---------------------------------------------------------
   Links / icon actions
   --------------------------------------------------------- */

.twpim-templates-shell .twpim-link-btn,
.twpim-templates-shell .twpim-icon-btn {
    border: 0;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
}

.twpim-templates-shell .twpim-link-btn {
    padding: 5px 2px;
    color: var(--twpim-blue);
    font-size: 12px;
    font-weight: 500;
}

.twpim-templates-shell .twpim-link-btn:hover {
    text-decoration: underline;
}

.twpim-templates-shell .twpim-icon-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--twpim-border);
    border-radius: 8px;
    color: var(--twpim-muted);
    font-size: 14px;
}

.twpim-templates-shell .twpim-icon-btn:hover {
    color: var(--twpim-blue);
    border-color: #bdd2ee;
    background: #f7faff;
}

.twpim-templates-shell .twpim-icon-btn.twpim-danger:hover,
.twpim-templates-shell .twpim-danger {
    color: #d54c5b;
}

/* ---------------------------------------------------------
   Modal
   --------------------------------------------------------- */

.twpim-templates-shell .twpim-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.twpim-templates-shell .twpim-modal.is-open {
    display: flex;
}

.twpim-templates-shell .twpim-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(7, 25, 48, .58);
    backdrop-filter: blur(2px);
}

.twpim-templates-shell .twpim-modal-dialog {
    position: relative;
    z-index: 2;
    width: min(720px, 100%);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(7,25,48,.24);
}

.twpim-templates-shell .twpim-preview-dialog {
    width: min(900px, 100%);
}

.twpim-templates-shell .twpim-modal-header {
    padding: 22px 24px 18px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1px solid var(--twpim-border);
}

.twpim-templates-shell .twpim-modal-header h2 {
    margin: 0;
    color: var(--twpim-text);
    font-size: 21px;
    line-height: 1.25;
    font-weight: 650;
}

.twpim-templates-shell .twpim-modal-close {
    width: 36px;
    height: 36px;
    border: 1px solid var(--twpim-border);
    border-radius: 9px;
    background: #fff;
    color: #607895;
    cursor: pointer;
    font-size: 21px;
    line-height: 1;
    font-weight: 400;
}

.twpim-templates-shell .twpim-modal-close:hover {
    background: #f5f8fc;
}

.twpim-templates-shell .twpim-form-grid {
    padding: 22px 24px 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.twpim-templates-shell .twpim-form-grid label,
.twpim-templates-shell .twpim-margin-grid label {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 7px;
}

.twpim-templates-shell .twpim-form-grid label > span,
.twpim-templates-shell .twpim-margin-grid label > span {
    color: var(--twpim-text);
    font-size: 12px;
    font-weight: 600;
}

.twpim-templates-shell .twpim-form-full {
    grid-column: 1 / -1;
}

.twpim-templates-shell .twpim-form-grid input,
.twpim-templates-shell .twpim-form-grid select,
.twpim-templates-shell .twpim-margin-grid input {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid #d8e3ef;
    border-radius: 9px;
    background: #fff;
    color: var(--twpim-text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 400;
    outline: none;
}

.twpim-templates-shell .twpim-form-grid textarea {
    min-height: 100px;
    padding: 11px 12px;
    resize: vertical;
}

.twpim-templates-shell .twpim-form-grid input:focus,
.twpim-templates-shell .twpim-form-grid select:focus,
.twpim-templates-shell .twpim-margin-grid input:focus {
    border-color: #9fc1f7;
    box-shadow: 0 0 0 3px rgba(33,107,232,.08);
}

.twpim-templates-shell .twpim-form-grid small {
    margin-top: -2px;
    color: var(--twpim-muted);
    font-size: 11px;
    font-weight: 400;
}

.twpim-templates-shell .twpim-letterhead-area-panel {
    margin: 22px 24px 0;
    padding: 18px;
    border: 1px solid var(--twpim-border);
    border-radius: 12px;
    background: #f8fafd;
}

.twpim-templates-shell .twpim-letterhead-area-panel h3 {
    margin: 0;
    color: var(--twpim-text);
    font-size: 15px;
    font-weight: 600;
}

.twpim-templates-shell .twpim-letterhead-area-panel p {
    margin: 5px 0 15px;
    color: var(--twpim-muted);
    font-size: 12px;
    font-weight: 400;
}

.twpim-templates-shell .twpim-margin-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.twpim-templates-shell .twpim-modal-footer {
    margin-top: 24px;
    padding: 17px 24px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid var(--twpim-border);
}

/* Letterhead preview */

.twpim-templates-shell .twpim-preview-body {
    padding: 24px;
}

.twpim-templates-shell .twpim-letterhead-preview-stage {
    overflow: auto;
    padding: 25px;
    background: #eef2f7;
    border-radius: 11px;
}

.twpim-templates-shell .twpim-letterhead-paper {
    position: relative;
    width: min(100%, 794px);
    min-height: 1123px;
    margin: 0 auto;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 10px 25px rgba(20,50,90,.12);
}

.twpim-templates-shell .twpim-letterhead-paper > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.twpim-templates-shell .twpim-letterhead-content-area {
    position: relative;
    z-index: 2;
    min-height: 600px;
    color: var(--twpim-text);
    font-size: 13px;
}

.twpim-templates-shell .twpim-letterhead-content-area > * {
    display: block;
    margin-bottom: 10px;
}

/* ---------------------------------------------------------
   Toast / utility
   --------------------------------------------------------- */

.twpim-templates-shell .twpim-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 2147483647;
    max-width: 360px;
    padding: 13px 16px;
    border-radius: 10px;
    background: #102b4e;
    color: #fff;
    box-shadow: 0 12px 30px rgba(10,30,55,.22);
    font-size: 13px;
    font-weight: 400;
}

.twpim-templates-shell .twpim-login-required {
    max-width: 650px;
    margin: 50px auto;
    padding: 35px;
    text-align: center;
    border: 1px solid var(--twpim-border);
    border-radius: 15px;
    background: #fff;
}

/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */

@media (max-width: 1180px) {
    .twpim-templates-shell .twpim-sidebar {
        flex-basis: 250px;
        width: 250px;
        min-width: 250px;
    }

    .twpim-templates-shell .twpim-template-grid,
    .twpim-templates-shell .twpim-letterhead-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .twpim-templates-shell .twpim-template-main {
        padding: 32px 28px 55px;
    }
}

@media (max-width: 900px) {
    .twpim-templates-shell {
        display: block;
    }

    .twpim-templates-shell .twpim-sidebar {
        width: 100%;
        min-width: 0;
    }

    .twpim-templates-shell .twpim-brand {
        min-height: 88px;
        padding: 20px 22px;
    }

    .twpim-templates-shell .twpim-nav {
        display: flex;
        overflow-x: auto;
        gap: 4px;
        padding: 10px 14px 14px;
    }

    .twpim-templates-shell .twpim-nav-item {
        width: auto;
        min-width: max-content;
        margin: 0;
    }

    .twpim-templates-shell .twpim-topbar {
        padding: 15px 22px;
    }

    .twpim-templates-shell .twpim-top-search {
        width: 55%;
    }
}

@media (max-width: 700px) {
    .twpim-templates-shell .twpim-topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .twpim-templates-shell .twpim-top-search {
        width: 100%;
    }

    .twpim-templates-shell .twpim-top-user {
        justify-content: flex-start;
    }

    .twpim-templates-shell .twpim-template-main {
        padding: 24px 16px 45px;
    }

    .twpim-templates-shell .twpim-template-section {
        padding: 20px;
    }

    .twpim-templates-shell .twpim-section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .twpim-templates-shell .twpim-template-grid,
    .twpim-templates-shell .twpim-letterhead-grid,
    .twpim-templates-shell .twpim-form-grid {
        grid-template-columns: 1fr;
    }

    .twpim-templates-shell .twpim-form-full {
        grid-column: auto;
    }

    .twpim-templates-shell .twpim-margin-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .twpim-templates-shell .twpim-modal {
        padding: 12px;
    }

    .twpim-templates-shell .twpim-modal-dialog {
        max-height: calc(100vh - 24px);
    }
}

@media (max-width: 430px) {
    .twpim-templates-shell .twpim-brand-copy strong {
        font-size: 13px;
    }

    .twpim-templates-shell .twpim-template-heading h1 {
        font-size: 30px;
    }

    .twpim-templates-shell .twpim-margin-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------------------------------------------------------
   Print
   --------------------------------------------------------- */

@media print {
    .twpim-templates-shell .twpim-sidebar,
    .twpim-templates-shell .twpim-topbar,
    .twpim-templates-shell .twpim-template-heading,
    .twpim-templates-shell .twpim-template-section:not(.twpim-letterhead-section) {
        display: none !important;
    }

    .twpim-templates-shell,
    .twpim-templates-shell .twpim-workspace,
    .twpim-templates-shell .twpim-template-main {
        display: block;
        padding: 0;
        background: #fff;
    }

    .twpim-templates-shell .twpim-letterhead-preview-stage {
        padding: 0;
        background: #fff;
    }

    .twpim-templates-shell .twpim-letterhead-paper {
        box-shadow: none;
    }
}
